Changes

Jump to: navigation, search

JavaScript Window Object

575 bytes added, 19:26, 9 May 2007
Closing Browser Windows using JavaScript
== Closing Browser Windows using JavaScript ==
 
A window can be closed using the window object's ''close()'' method. The name of the window (specified in the ''open()'' method should be referenced when performing a close so that you are certain to close the correct window. For example the following code creates a new window and creates a pushbutton which, when clicked, closes the new window:
 
<pre>
 
<script language="JavaScript" type="text/javascript">
 
newWindowObj = window.open ("", "MyWindow");
 
</script>
 
<form action="null">
<input type="button" value="Close Window" onclick="newWindowObj.close()" />
 
</pre>

Navigation menu