Javascript >>
Popup window example
Close popup
window
This example shows
different ways to close the popup window.
(1) Close popup
window after a pre-determined amount of time.
For example, set
a popup window to remain open for 6 seconds, then it automatically closes.Put
the following code in <body> tag.
<body
onload=setTimeout("self.close()",6000);>
(2) Add a text/image
link or a button in the pop
window
You can add an
image link or text link in the popup window, that will allow the user to "Close
Window". Insert the following code between the <BODY> and </BODY> tags
of the popup window.
<a
href="javascript:window.close()"><img border="0" src="name.gif"></a>
OR
<a
href="javascript:window.close()">Close this window</a>
(3) To add a
button that will allow the user to Close Window, insert
the following code between the <BODY> and </BODY> tags of the popup window.
<form>
<input type="button" value="Close this window" onClick="window.close()">
</form>