Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delay function for self-closing browser. 1

Status
Not open for further replies.

soonkhoo

Programmer
Dec 8, 2000
133
MY
Hi all, hoping someone could help me with a delay function that when a child window is opened, it will close automatically within the time set. Thanks.
 
you can use setTimeout for that.


setTimeout("function()", 3000);

executes function after three seconds
 

I did that, but it didn't close entirely, instead, it minimized it. There must be something wrong with my code.
First of all, where did you put this setTimeout function?
 
<html>
<head>
<script language=&quot;JAVASCRIPT&quot;>
function closepopup(){
setTimeout(&quot;window.close()&quot;, 5000);
}
</script>
<title>.....Try Again...... </title>
</head>
<body bgcolor=&quot;#0066CC&quot; onload=&quot;closepopup&quot;>
<center>
<font face=&quot;Courier New, Courier, mono&quot;><b>Sorry, incorrect.</b></font><br>
<br>
<input type=&quot;button&quot; value =&quot;OK&quot; onClick=&quot;window.close()&quot;>
</center>
</body>
</html>
 
<body bgcolor=&quot;#0066CC&quot; onload=&quot;closepopup&quot;>

should be :

<body bgcolor=&quot;#0066CC&quot; onload=&quot;closepopup()&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top