1 <head> 2 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 3 <title>无标题文档</title> 4 <script type="text/javascript"> 5 function countDown(secs,surl){ 6 //alert(surl); 7 var jumpTo = document.getElementById(‘jumpTo‘); 8 jumpTo.innerHTML=secs; 9 if(--secs>0){ 10 setTimeout("countDown("+secs+",‘"+surl+"‘)",1000); 11 } 12 else{ 13 location.href=surl; 14 } 15 } 16 </script> 17 </head> 19 <body><span id="jumpTo">5</span>秒后自动跳转到http://www.baidu.com/ 20 <script type="text/javascript">countDown(5,‘http://www.baidu.com/‘);</script> 21 </body> 22 </html>
时间: 2024-11-06 21:58:50