<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script type="text/javascript">
<!--
var duration=10000; //毫秒值
var endTime = new Date().getTime() + duration + 100;
function interval()
{
var n=(endTime-new Date().getTime())/1000;
if(n<0) return;
document.getElementById("timeout").innerHTML = n.toFixed(3);
setTimeout(interval, 10);
}
window.οnlοad=function()
{
setTimeout("window.location.href='http://yongzhi.blog.hexun.com/'", duration); //duration 毫秒后要执行的操作
interval();
}
//-->
</script>
<title>毫秒倒计时</title>
</head>
<body>
<form id="form1" runat="server">
<h3>毫秒倒计时</h3>
<div>
10秒倒计时:<span id="timeout">10.000</span>
</div>
</form>
</body>
</html>
Javascript实现毫秒倒计时
最新推荐文章于 2021-12-27 08:43:51 发布