javascript|弹出窗口
弹出窗口时间延迟 源码如下
-------------------------------
脚本说明:
把如下代码加入<body>区域中
<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>下面的代码演示了如何先创建一个新窗口8.htm,然后迅速转换到另外的页面9.htm上。 </P>
<P><SCRIPT LANGUAGE="JavaScript">
<!--
function
mywin1(){
mywindow1 =
window.open('8.htm','myexample1','width=200,height=200');
mywindow1.location.href
= '9.htm';
}
//-->
</SCRIPT></P>
<P><INPUT name=Submit onclick=mywin1() type=submit value="请看演示">
</P>
<P>但是上面的代码几乎没有什么实际的用途,因为窗口几乎没有任何停顿就迅速从8.htm切换到9.htm,所以我们做一点修饰,加上5秒的延迟再进行页面的切换,这样更有实际意义。5000代表5秒,单位是毫秒。</P>
<P><SCRIPT LANGUAGE="JavaScript">
<!--
function
mywin2(){
mywindow2 =
window.open('8.htm','myexample2','width=200,height=200');
setTimeout("mywindow2.location.href
= '9.htm'",<FONT
color=#990099>5000</FONT>);
}
//-->
</SCRIPT></P>
<P><INPUT name=Submit2 onclick=mywin2() type=submit value="请看演示">
</P>
</TD></TR></TBODY></TABLE>