求大神指點(diǎn),怎么才回顯示倒計時呢?我這個5秒一到就轉(zhuǎn)了,但是頁面上不會經(jīng)過54321遞減,一直顯示5秒后
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title>?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>??
?</head>
?<body>
? <div>
???? <h2>操作成功</h2>
???? <a><strong>5</strong>秒后返回主頁</a>
???? <a href="window.history.back()">返回</a><!--先編寫好網(wǎng)頁布局-->?
?</div>
? <script type="text/javascript">
?? function haha(){
?????? var time=new Date();
?????? attent=time.getSeconds();??????
?????? if(attent==5){
?????????? window.open('http://www.baidu.com','_blank','width=700px,height=600px');
?????????? clearInterval(setInterval(haha,1000));
?????? }//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
}
????? setInterval(haha,1000);
?? //通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。??
?</script>
</body>
</html>
2015-08-19
你真的獲取打牌指定元素了么?