Entry
how can i close a child window without events, after the page finish displaying all it contents
Apr 6th, 2008 18:35
ha mo, Colin Fraser, alex odeh,
The question really is how long do you want your popup to display before
you close it? You could always do something like
<body onload="self.close()">
which triggers immediately after the document has finished loading, or
it is supposed to. However, this is always risky, even if the syntax is
right. You may however want a delay :
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript"><!--
function winClose() {
setTimeout('self.close()',10000);
}
//--></SCRIPT>
</HEAD>
<BODY>
....page text here....
<SCRIPT LANGUAGE="JavaScript"><!--
//and at the end of the page place this call
winClose()
//--></SCRIPT>
</BODY>
</HTML>
You may feel that 10 seconds is too long, so make it 5000 to display for
only 5 seconds. However, you could also use the onLoad event to make
sure that all images and text and anything else is downloaded. In that
case, the body tag reads
<body onLoad="winClose()">
I would not recommend you do anything fancy, but you could set the time
out according to some whim, say ask for a name then calculate the total
value of the letters and assign that to a variable which then uses the
number as the time out value. You could also do lots of ther things but
they would generally be time wasting... good luck..
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com