首页 > 代码库 > 10s倒计时

10s倒计时

<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html;charset=utf8">
<head>
<title>倒计时</title>
</head>
<body>
请等待<span id="dd">10</span>秒
<script type="text/javascript">
function run(){
var s = document.getElementById("dd");
if(s.innerHTML == 0){
window.location.href=http://www.mamicode.com/‘#‘;
return false;
}
s.innerHTML = s.innerHTML * 1 - 1;
}
setInterval("run();", 1000);
</script>

 


</body>
</html>

10s倒计时