Click to See Complete Forum and Search --> : interacting between 2 windows using js
g1nger_one
01-29-2004, 11:39 AM
I'm a little bit of a newbie when it comes to Javascript but it is often the easiest way to do things.
Anyways I'm looking for a way to interact a text field in one window with a click in another window.
The only real clue I'm lacking is how to give the two pages different names.
i.e. instead of document.textfield1.text.whatever
have something like mydocument.textfield1.text.whatever
Thanks for the help!
It is becoming very time consuming to find a solution as it isn't in basic tutorials and I can't find the time to go through more complete tutorials.
Jeff
TheBearMay
01-29-2004, 11:50 AM
You can do it with the window.open(URL, "myDocument", Params) command or by issuing window.name="myDocument" after the window is open.
g1nger_one
01-29-2004, 12:18 PM
ta
g1nger_one
01-29-2004, 01:01 PM
Right, typical it didn't work first time.
Just tell me if this looks right.
I have a page with a link on it:
<A HREF="/gykd/picbin/small/pictureviewer.html" target="_blank"><IMG SRC="/gykd/picbin/system/help.gif" BORDER="0" onClick="window.name='mydocument' "></A>
So when the user clicks on the link it renames the current page and opens the new page.
On the new page it has an image that the user clicks on, to select that image. What I want to happen is that on the click it changes the text in a text box on the other page.
<A HREF="javascript:void(0)"><IMG SRC=%s%s BORDER="0" onClick="mydocument.userform.image.value = '%s' "></A>
Does this look like it should work?
g1nger_one
01-29-2004, 11:52 PM
Any help would be really apriciated!
Either, the name is not being changed with the first link, or more likely my call to the text box value is not correct.
How would I get hold of a text box in another window that would normally be got (if in the same window) by:
document.userform.image.value
It seems like a simple bit of information but it is becoming very hard to find out.
TheBearMay
01-30-2004, 07:44 AM
If the value is in the window that opened the current window try something like:
onclick="window.opener.userform.image.value ='New Value';"
g1nger_one
02-02-2004, 01:12 AM
Thanks that worked a treat!
Much apriciated!