Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Sending data between pages

Communicating between two windows -- by link9
Posted: 27 Apr 01

Crash course here -- this question has been asked a few times in the last couple of days, so I worked up this very simple example that I think lays the groundwork for what could be turned into something much more complicated if you're so inclined.

The question is, "Can two browser windows communicate between each other?"

The answer is yes, and here's how:

If you have a parent-child relationship between the two browsers, it's fairly simple.  Here's an example:

<script language="javascript">
function openMe(){
  var x = window.open('newOne.htm', 'newWindow', 'height=300,width=300');
<form name=theForm>
<INPUT type=button value="Open It" name=submit1 onClick="openMe();">
<input type=text name=theBox>

<script language=javascript>
  function setOther(){
    window.opener.theForm.theBox.value = document.myForm.thisBox.value;
<form name=myForm>
  <input type=text name=thisBox>
  <input type=button value="Click Me" onClick="setOther();">

Now all that does is when you click the button, it opens up the new page in a pop up window, and when you type something in the text box in the pop up, and push that button, it assigns that value back to the text box on the original page.  From this example, though, it's easy to see how to communicate between the two windows.

Happy Coding Everyone!   

Back to Javascript FAQ Index
Back to Javascript Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close