<script type="text/javascript">
<!--
var duration=9900
var endTime = new Date().getTime() + duration + 100
function interval()
{
var n=(endTime-new Date().getTime())/1000
if(n<0) return
document.getElementByIdx("timeout").innerHTML = n.toFixed(3)
setTimeout(interval, 10)
}
window.onload=function()
{
setTimeout("window.location.href='http://www.17mm.net'", duration)
interval()
}
//-->
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>等待10秒</title>
</head>
<body>
<form id="form1" runat="server">
<div>
现在剩下 <span id="timeout">10.000</span>秒后将自动跳转</div>
</form>
</body>
</html>
//t 倒计时多少s callback 倒计时完后要执行的function方法function djs(t, callback) {
var ts = setInterval(function () {
t -= 1
if (t == 0) {
clearInterval(ts)
callback(callback)
}
},1000)
}
//10s后弹出 xx
$(function () {
djs(10, function () {
alert("xx")
})
})