References to Window Objects
<HTML>
<HEAD>
<TITLE>Window Opener and Closer</TITLE>
<SCRIPT LANGUAGE="JavaScript">
var newWindow;
function makeNewWindow() {
newWindow = window.open("","","HEIGHT=300,WIDTH=300")
}
function closeNewWindow() {
if (newWindow) {
newWindow.close()
newWindow = null
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="button" VALUE="Create New Window" onClick="makeNewWindow()">
<INPUT TYPE="button" VALUE="Close New Window" onClick="closeNewWindow()">
</FORM>
</BODY>
</HTML>
Related examples in the same category