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