不知此代碼為何無法實現(xiàn),求教,謝謝!
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<script type="text/javascript">
?function jishu(){
? ? ?var num=document.detElementById("second");
? ? ? ? num=num-1;
? ? ? ? document.detElementById("second")=num;
? ? ? ? ? ? if(num==1){
? ? ? ? ? ? ? ? window.open('idcbgp.cn','_blank');
? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? else { setTimeout(jishu,1000);}
? ?
?
? ?//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
? ?//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。
?}
?window.onload=jishu;
?</script>?
?<body>
? <!--先編寫好網(wǎng)頁布局-->
? <strong>操作成功<br>
? <br>
<b id="second">5</b>
? </strong>秒后回到主頁<a href="idcbgp.cn">返回</a>
?
??
</body>
</html>
2016-07-20
<p style='font-weight:bold'>操作成功</p>
? <span style="font-weight:bold" id='second'>5</span>秒后回到主頁 <em><a href='javascript:back()'>返回</a></em>
?
? <script type="text/javascript"> ?
?var num=document.getElementById("second").innerHTML
? ?function count()//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)
? ?{
? ? ? ?num--
? ?document.getElementById('second').innerHTML=num
? if(num==0)
? {location.assign('idcbgp.cn')
? ? ? }
}
setInterval('count()',1000)
? ?//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。
? ?function back()
? ?{
? ? ? ?window.history.back()
? ?}
2016-07-20
setInterval(jishu(),1000)這一步你沒有,上面兩部是你有的但是沒有innerHTML,還有你那個IF語句中應該是==0,else中的就不用了
2016-07-20
var num=document.detElementById("second").innerHTML
2016-07-20
getElementById('second').innerHTML=num
2016-07-20
getElement 改了還是不行