Script to close a window
by Geethalakshmi[ Edit ] 2010-09-16 21:14:13
Script to close a window
The following script creates a button that, when clicked, calls the close method of the window object.
<button onclick="javascript:window.close()">Close</button>
Alternatively, you can close the window by using an A element and putting the JavaScript code in the href attribute, as shown in the following code. This code also uses the close method of the window object.
<a href="javascript:window.close()">Close</a>