...

View Full Version : how close popups?



seanr_us
07-08-2007, 04:52 PM
i dont know how to close popups by itself. i did window.open () and refresh but how can i make it close automaticly with time remaining?
thank you.

Philip M
07-08-2007, 05:58 PM
If I understand you correctly, you want to close a pop-up window automatically after a certain period of time.

Try this:-

Place the following in the <body> tag:-

onLoad= "setTimeout('window.close()',5000)"; // 5000 is time in milliseconds, i.e. 5 seconds or whatever value is appropriate.

seanr_us
07-09-2007, 03:48 PM
appriciate for ur help but i think some thing is not right for what i have here. would u take a look and see where the problem cause? thank you

<html>
<head>
<title>pop</title>
</head>
<body>


<SCRIPT LANGUAGE="javascript">
<!--
window.open ()
-->
</SCRIPT>
<meta http-equiv="refresh" content=".2">
</body>
onLoad= "setTimeout()',1)"; //
</html>

Philip M
07-09-2007, 07:10 PM
Place the following in the <body> tag:-

onLoad= "setTimeout ('window.close()', 5000)"; // 5000 is time in milliseconds, i.e. 5 seconds or whatever value is appropriate.

Thus:-

<html>
<head>
<title>pop</title>

<script type = "text/javascript">
window.open ();
</script>

</head>

<body onLoad = "setTimeout('window.close()', 5000)";>

<The text or content of your pop-up window goes in here>

</body>
</html>

Bill Posters
07-09-2007, 07:29 PM
Unless, I'm mistaken, I think the idea is that the main window contains the popup script and the popup contains the self-closing script.

e.g.

parent document...

...

<script type="text/javascript">

window.open('urlofchilddocument');

</script>
</head>
...

child document (in popup window)

...

<script type="text/javascript">

window.onload = function() {

setTimeout('window.close()', 5000);

}

</script>
</head>
...

...sorta thing.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum