You are here: irt.org | FAQ | JavaScript | Window | Q338 [ previous next ]
In the main page:
<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"><!-- myPopup = ''; function openPopup(url) { myPopup = window.open(url,'popupWindow','width=640,height=480'); if (!myPopup.opener) myPopup.opener = self; } //--></SCRIPT> </HEAD> <BODY> <FORM> <INPUT TYPE="BUTTON" VALUE="Open Popup" onClick="openPopup('popupPage.html')"> </FORM> <FORM NAME="hiddenForm" ACTION="nextPage.html"> <INPUT TYPE="HIDDEN" NAME="myTextField"> </FORM> </BODY> </HTML>
In the popupPage.html:
<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript"><!-- function copyForm() { opener.document.hiddenForm.myTextField.value = document.popupForm.myTextField.value; opener.document.hiddenForm.submit(); window.close(); return false; } //--></SCRIPT> </HEAD> <BODY> <FORM NAME="popupForm" onSubmit="return copyForm()"> <INPUT TYPE="TEXT" NAME="myTextField"> <INPUT TYPE="BUTTON" VALUE="Submit" onClick="copyForm()"> </FORM> </BODY> </HTML>