Window to window communication

Steven W. Disbrow
Listing 2. child.htm.

<TITLE>Window to Window Communication - Child Window</TITLE>
<script language="javascript">
var myParent = self;
var linked = false;

 // This function checks to see if we have a link
// established with out parent window.
function checkLink() {
	if (myParent != self)
		linked = true
		setTimeout( "checkLink()", 2000)

 // This function calls a function in the parent window
function passInfo( f) {
	if (linked)
		myParent.showInfo( f)
		alert("Link with parent window not yet established.... Try again in a few seconds!")

<BODY onLoad="checkLink()">
<form name="f">
First name:<input type="text" name="fName"><br>
Last name:<input type="text" name="lName"><br>
<input type="button" value="Send Info To Parent Window" onClick="passInfo( this.form)">

About the Author

Steven Disbrow is the owner of EGO Systems, a computer consulting firm in Chattanooga, TN. He can be contacted at [email protected].