Javascript pop-up window delay

Source: Internet
Author: User
Tags window
Javascript| pop-up window

Pop-up window time delay source is as follows
-------------------------------

Script Description:
Add the following code to the <body> area
<script language=javascript>
<!--
function Mywin1 () {
Mywindow1 = window.open (' 8.htm ', ' myexample1 ', ' width=200,height=200 ');
Mywindow1.location.href = ' 9.htm ';
}
function Mywin2 () {
Mywindow2 = window.open (' 8.htm ', ' myexample2 ', ' width=200,height=200 ');
settimeout ("mywindow2.location.href = ' 9.htm '", 5000);
}
-->
</SCRIPT>
<table border=0 cellpadding=5 cellspacing=0 width=550>
<TBODY>
<tr bgcolor= #f3f3f3 >
<TD>
<P> The following code demonstrates how to first create a new window 8.htm and then quickly switch to another page 9.htm. </P>
<p><script language= "JavaScript" ><BR><!--<br>function
Mywin1 () {<br>mywindow1 =
window.open (' 8.htm ', ' myexample1 ', ' width=200,height=200 '); <br>mywindow1.location.href
= ' 9.htm ';<br>}<br>//--><br></script></p>
<p><input name=submit onclick=mywin1 () type=submit value= "See demo" >
</P>
<P> But the code above has little practical use because the window switches from 8.htm to 9.htm almost without any pauses, so it's more practical to make a little bit of a modification, plus a 5-second delay and then a page switch. 5000 represents 5 seconds, and the unit is milliseconds. </P>
<p><script language= "JavaScript" ><BR><!--<br>function
Mywin2 () {<br>mywindow2 =
window.open (' 8.htm ', ' myexample2 ', ' width=200,height=200 '); <br>settimeout ("Mywindow2.location.href
= ' 9.htm ', <font
color= #990099 >5000</FONT>);<br>}<br>//--><br></script></p>
<p><input name=submit2 onclick=mywin2 () type=submit value= "See demo" >
</P>
</TD></TR></TBODY></TABLE>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.