html javascript js 倒计时 跳转 页面

  1. <html>    
  2. <head><title></title>    
  3. <script language='javascript' type='text/javascript'>    
  4. var secs =5; //倒计时的秒数    
  5. var URL ;    
  6. function Load(url){    
  7. URL =url;    
  8. for(var i=secs;i>=0;i--)    
  9. {    
  10. window.setTimeout('doUpdate(' + i + ')', (secs-i) * 1000);    
  11. }    
  12. }    
  13. function doUpdate(num)    
  14. {    
  15. document.getElementById('ShowDiv').innerHTML = '将在'+num+'秒后自动跳转到 黑色头发的blog' ;    
  16. if(num == 0) { window.location=URL; }    
  17. }    
  18. </script>    
  19. </head>    
  20. <body>    
  21. <div id="ShowDiv"></div>    
  22. <script language="javascript" type='text/javascript'>    
  23. Load("http://heisetoufa.javaeye.com"); //要跳转到的页面    
  24. </script>    
  25. </body>    
  26. </html> 

陆慧在aspx代码中做的测试,实验成功

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script language='javascript' type='text/javascript'>    
var secs =5; //倒计时的秒数    
var URL ;    
function Load(url){    
URL =url;    
for(var i=secs;i>=0;i--)    
{    
window.setTimeout('doUpdate(' + i + ')', (secs-i) * 1000);    
}    
}    
function doUpdate(num)    
{    
document.getElementById('ShowDiv').innerHTML = '将在'+num+'秒后自动跳转到 黑色头发的blog' ;    
if(num == 0) { window.location=URL; }    
}    
</script>    
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    </div>
    <div id="ShowDiv"></div>    

    <script language="javascript" type='text/javascript'>    
Load("http://heisetoufa.javaeye.com"); //要跳转到的页面    
</script> 
    </form>
</body>
</html>

posted @ 2009-05-07 21:46  Daniel_Lu  阅读(531)  评论(0编辑  收藏  举报