Window to window communication

Steven W. Disbrow
Listing 1. parent.htm.

<TITLE>Window to Window Communication - Parent Window</TITLE>
<script language="javascript">
var childWindow = null

// Give the child window a link back to its parent
function makeLink() {
	// Is the entire file loaded in the window?
	if (childWindow.document.forms.length > 0)
		childWindow.myParent = self;
		// No? Wait one second and try again
		setTimeout( "makeLink()", 1000)

 // This function opens the child window
function openChild() {
	childWindow = "child.htm", "child", "")

 // Display the info from our child window
function showInfo( f) {
	alert( "First Name - " + f.fName.value + "\nLast Name - " + f.lName.value)

<form name="f1">
<input type="button" value="Open Child Window"

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].