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"><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="請看示範">
</P>
<P>但是上面的代碼幾乎沒有什麼實際的用途,因為視窗幾乎沒有任何停頓就迅速從8.htm切換到9.htm,所以我們做一點修飾,加上5秒的延遲再進行頁面的切換,這樣更有實際意義。5000代表5秒,單位是毫秒。</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="請看示範">
</P>
</TD></TR></TBODY></TABLE>