為什么結(jié)果不會跳轉(zhuǎn),還回出現(xiàn)負(fù)秒數(shù)???真是搞不懂
? <script type="text/javascript"> ?
?
? ?//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
? ? var ?time=document.getElementById("sec").innerHTML;
? ?//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。
? ?function count(){
? ? ? ?time--;
? ? ? ?document.getElementById("sec").innerHTML=time;
? ? ? ?if(time==0)
? ? ? ?{
? ? ? ? ? ?location.assign("idcbgp.cn");
? ? ? ?}
? }
? setInterval("count()",1000);
? function back(){
? ? ? window.history.back();
? }
?</script>?
2017-01-03
你這個代碼沒問題啊,我復(fù)制下來測試了,除了不能跳轉(zhuǎn)成功原因是網(wǎng)址沒加"http://"
2017-01-03
<script type="text/javascript"> ?
? ? var ?time=5; //直接來個數(shù)字
? ?function count(){
? ? ? ?time--;
? ? ? ?document.getElementById("sec").innerHTML=time;
? ? ? ?if(time==0)
? ? ? ?{
? ? ? ? ? ?location.href="idcbgp.cn";
? ? ? ?}
? }
?setInterval("count()",1000);
?</script>?