计时器:倒计时,自动跳转

计时器:倒计时,自动跳转

<body>
    <input type="text" readonly="true" value="10" id="time">
</body>
<script language="javascript"> var t = 60;//60个1秒 var time = document.getElementById("time"); function fun(){ t--; time.value = t; if(t<=0){ window.location = "PostTestController.action?testId=" + testId; //提交 clearInterval(inter); } } var inter = setInterval("fun()",1000); //1000毫秒=1秒 </script>

 

posted @ 2020-12-19 02:28  淇凌  阅读(241)  评论(0编辑  收藏  举报