Saturday, January 23, 2010

Close a window in one click

With Javascript it's possible close a window in one click, to do this is necessary a link or a button and only one line of code!


The close function do the right thing:

window.close();


Now two examples that shows how use the close function.


<!--On a link-->
<a href="#" onclick="window.close();return false;">

<!--On a button--> 
<input type="button" name="Bottone" value="Chiudi" Onclick="window.close();">

Example:

Click this link to open a popup window

Click this link to close the popup

No comments:

Post a Comment