Script to close a window

by Geethalakshmi 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>

Tagged in:

787
like
0
dislike
0
mail
flag

You must LOGIN to add comments