Forum Moderators: open
I want to make a page that i keep open,
and if a users presses the ok button on another page, the value of a txt on that page appears in the txt of the page I keep open.
Is this possible using javascript?
You can do this if one of the windows opened the other.
Let's suppose that you have a page called js_opener.htm that contains a function to open another page called js_opened.htm:
<script type="text/javascript">
<!--
//initialize myWindow as a global variable
var myWindow
//myFunction opens a new window
function myFunction(){
myWindow=window.open('js_opened.htm')
}
//-->
</script>
Once the function has been called and the page opened, you have a variable reference to the window. This means that you could have code like:
myWindow.document.forms[0].myTextbox.value='Hello!'
on js_opener.htm which would set the value of the myTextbox object on js_opened.htm.
Conversely, you can have the opened page act upon the opening page using the 'opener' reference.
From the opened page, you can have code like:
window.opener.document.forms[0].myOpenerPageTextbox.value='Hey, this works!'
which would set the value of the myOpenerPageTextbox object on js_opener.htm.
Hope this helps!
ajkimoto