PDA

View Full Version : Window auto close + Window auto open


edalb
05-10-2005, 06:48 AM
Hi all

I am looking for a script that when a page is opend it will display onle for 5 or 6 seconds then it must open a new window in the same page.

Thank you

WMJB
05-10-2005, 07:16 AM
You dont need javascript to accomplish this effect. You just need to use a refresh meta tag.

see:
http://www.indiana.edu/~wmhome/tool_guide_info/refresh_metatag.shtml
for info.

rlemon
05-10-2005, 04:40 PM
if you are intent on using JS then something like this would work.

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
var myUrl;
var myTimeout;
function popup(url, timeout){
myUrl = url;
var make;
make = setTimeout("doOpen()",Math.round(timeout * 1000));
}
function doOpen(){window.open(myUrl,'');}
</script>
</head>
<body onload="popup('http://www.google.ca','3')">
when calling the popup funtion you will need to pass in two values. The url, and the timeout in second.<br /> so in the example below i have <i>onClick="popup('http://google.ca','10')"</i> or goto = google.ca, timeout = 10 seconds.
<br /><input type="button" value="open popup" onClick="popup('http://google.ca','10')">
</body>
</html>