In Firefox, the JavaScript code an interact with the document object to affect HTML structure and CSS style rules as well as define behaviors for given events.
Can the JavaScript code also modify elements of the window object, like menus, not just enable or disable them in a new window? If so, how?
Dynamically creating and assigning elements to a dialog, but I am unable to modify the elements after the window opens. I know that I can see them and they are being correctly assigned because I can look at them with firebug.I was thinking that one source of the problem may be the badly formed html that I am getting out. shouldn't each input tag end with " />"?
assist with how to modify a specific css value of an object? For example, I want to do over all children of "body", and see if they have any css attributes containing a url(xxxxx) part. If so, I would like to make some change to that url (replace it with something else).
I'm having problems changing a table from a child window.
What works (but I really want to add more complex objects to teh cells not just plain text)
var myTable = self.opener.document.getElementById("MY_TABLE");
var row = myTable.insertRow(); var cell = row.insertCell(); cell.innerText = "New value";
I've tried the two below methods but they both fail.
var myTable = self.opener.document.getElementById("MY_TABLE"); var row = myTable.insertRow(); var cell = row.insertCell(); cell.appendChild(self.opener.document.createTextNo de("New Value")); <-- Gives me an error of "Invalid arguement"
I've also tried
cell.appendChild(document.createTextNode("New Value")); <-- Gives an error of "No such interface supported"
Is it possible to remote modify an already open window form from a local HTML file? Example (simplified):
1. I have a local HTML file, where I have some kind of link. When this link is pressed, then I need to add a "searchstring" into... 2. the second already opened window form (e.g. Google)
I need to do this to avoid any copy / pasting of these values.
All I have read about is that this is possible if I use Parent/Child windows, but I would like to know if this is possible to do between two independant pages?
Is that possible I can assign an window object variable to an already opened window? With window.open(), we can get a window object from opened window. If a window has already opened, is there any way I can attach that window with an object variable in javascript? Because I want to communicate with that window.
but what I need is, after the new window is popped up, the opener will be redirected to another page, I want the another page able to control the popup window is it possible? is there something like getWindowById.
Goal: From window A, I want to manipulate the DOM of window B, where window B is the result of calling window.open(). My attempts are shown below, but Window B is never updated. winRef = window.open("","Window B"); Try 1: $(winRef).find("body").append("<div id=container>mr container</div>"); Try 2: $(winRef).find("body").html("<div id=container>mr container</div>"); Try 3: $(winRef.document.body).append("<div id=container>mr container</ div>"); Try 4: $(winRef.document.body).html("<div id=container>mr container</div>"); The jQuery Core doc [URL] claims that it can wrap a window object. Browser is FF2.0
i want to send a html / javascript 'document.write' object from the first window to the textarea of second window to send it to email, The code snippet is thus:
FIRST WINDOW _____________________________________________________________________________ <html> <head> <script language="javascript">
Have a select box. Want to remove selected options, but save them. Can then put them back in later. That works fine in the code below. But any time they are saved, the previously saved ones are wiped out. Haven't been able to figure out how to add new elements to an existing jQuery object. Even when I try to use .add(), it still wipes out the old ones? [code]...
I am trying to read all the navigator object elements
1. Using the navigator.length returns undefined, cant use for loop;
2.Using and array of known elements like var a = Array("appCodeName","appName","appVersion"); I seem to miss something to get it combined like navigator.a[i]
It looks like when I do $("object").bind("<mouse-event>") the event isn't actually being bound to the element in Chrome and Firefox (not sure about IE). Using $("object").each(function()
I get an error when I try to dynamically add an attribute to some elements, since I been getting the error "Object doesn't support this property or method" in IE I reduced the attribute value to just alert.
Code JavaScript:
Note that in firefox all the elements with the class boxcontainer gets "hello world" alert. I removed this specific code (shown above) out of the page and the error in IE goes away, so I'm 100% sure nothing else is causing it.
Is it possible to have a javascript read elements from one browser tab from another? What I want to do is have a simple script that refreshes a page that I don't host every second or so and if the text on it changes from a preset string then to stop refreshing. So I have one tab open running the JS that I host which is pressing refresh repeatedly on the other tab and if that changes then it stops refreshing.
I've tried to think of a way to do this server-side (PHP) but couldn't think of one. I could make a script that reads the remote page repeatedly and if it changes then loads it, but to load it the remote page would refresh and then would probably lose the string I am after.
Even if just to say "nah, not possible" or something about XSS that I don't really understand...!
I have found out that doing a window.resizeTo(w,h) does not resize the client area tot his size, but the entire window (including tool bars etc).
So, with an address bar, a tool bar and a status bar etc showing, the window.document.body.offsetHeight value will be ~200 points smaller than the required size.
We have a simple set of data in a table, but it can resize based on a font size. On change of font from a combo we call a resize function.
How can I ensure that the body.offsetHeight and widths are enough to show all of my table, without hard coding for toolbars etc (Because they may not be there on some browsers.)
Is there a way like in java to *pack* the client area to best fit?
I have a main window in which there is a link opening popup. In newly opened window there are links that allow to insert some HTML with form elements ( button) in the parent window document. The problem is when user closes popup window the added button is inactive (action assigned to it doesnt work) What is more the problem exists in IE, in FF code works quite well.The code inserting new elements to parent window is below.[code]
It's pretty simple stuff that just populates an empty div with an image link to bookmark the page when users have javascript enabled. Now when I call the function using <body onload="add_favorite();"> and cancel out the window.onload=add_favorite(); from the script it works just fine (it throws a line-1 syntax error up in IE that I can't figure out, but functionally everything still works in IE7 and FF2). When I try to do it the "unobtrusive" way I get nothing at all in either browser.
A little debugging revealed that the function is indeed being called and is running successfully, however the function is somehow unable to locate the element with ID of "bookmark" when it is fired with window.onload and as a result I get no bookmarking link. It's almost like window.onload is triggering itself too soon, before the div of "bookmark" is in the page, but how can that be?
I have a window with a form that is accessed directly. I would like to pop open another window from it and make the new window the parent/opener. I've tried the following but I keep getting 'opener is null' after trying to access the new parent's Javascript methods.
I have tried this using both frames and window.open(). In either case, if the new content comes from a different site than the original (or comes from a site and original is a local file) the document object is inaccessible. The new window object seems to have no document and no all[] or just about anything else useful. If the new content came from the same site (or local computer) as the original, everything seems to be where it belongs. I have looked all over and can find no references to this problem. Is this some security issue that everybody but me knows about?
I am seeing this on IE 6.0.2800.1106. The files are created in notepad so there should be no surprises there.
The general outline is that I have part of a page that deals with the addition, editing and deletion of upcoming events. Data is stored in a MySQL table. The form design (in traditional terms) would be very simple requiring three fields, one for the Event Name, one for the Event Description and one (hidden) to identify the UniqueID of the event in the MySQL table. (As the reference to make edits.) The table therefore has 3 fields. (There are more such as Timestamp, clientID etc, but they are not important here.)
I envisage three functions, one to add, one to edit and one to delete the event listed on the page. I have 3 php files eventadd.php, eventedit.php and eventdelete.php which speak for themselves.However, this is where I have the problem. What I have been doing is returning the xmlhttpresponse as a formatted HTML page for the two 'form' elements because whilst I can return unformatted text containing the relevant fields in one response, I don't know how to break that down into two sections for the innerHTML of the two 'form' elements that change.
Returning a formatted page does work, but as well as being slower than neccessary, I am also running into character-set encoding issues and I just know that I am not doing this properly. I can supply code and things, but I have a feeling that this problem will have come up somewhere and probably has a recognized solution because to me it seems to be such an obvious requirement to be able to populate several form elements with fields from one recordset.