You are here: irt.org | FAQ | JavaScript | Window | Q166 [ previous next ]
First make sure that the original window can be referred to using opener:
<SCRIPT LANGUAGE="JavaScript"><!-- function newWindow(file,window) { msgWindow=open('',window,'resizable=no,width=200,height=200'); msgWindow.location.href = file; if (msgWindow.opener == null) msgWindow.opener = self; } //--></SCRIPT> <FORM> <INPUT TYPE="button" VALUE="Open New Window" onClick="newWindow('a.html','window2')"> </FORM>
Then in the new window:
<SCRIPT LANGUAGE="JavaScript"><!-- opener.open(); opener.document.write('Hello World'); opener.close(); //--></SCRIPT>