Close Window

A close window function is useful when you use a pop-up window on your page, as it allows the visitor to easily close the window. You can do it several ways: To use a button, paste the following where you want the button to appear:

<input type=button value="Close Window" onClick="javascript:window.close();">

For a text link, paste the following where you want the link to appear:

<a href="javascript:window.close();">Click to Close Window</a>

To make the window close after a given number of seconds, add the event handler to the <body> tag. FYI, 20000 equals 20 seconds.

<BODY onLoad="setTimeout(window.close,20000)">

Leave a Reply