1 <html> 2 <head> 3 <title>10秒后跳转</title> 4 </head> 5 <body> 6 <input type="text" readonly="true" value="10" id="time"> 7 </body> 8 <script language="javascript"> 9 var t = 10; 10 var time = document.getElementById("time"); 11 function fun(){ 12 t--; 13 time.value = t; 14 if(t<=0){ 15 location.href = "http://www.jb51.net"; 16 clearInterval(inter); 17 } 18 } 19 var inter = setInterval("fun()",1000); 20 </script> 21 </html>