自己寫的,歡迎糾錯
<!--先編寫好網頁布局-->
? ?<b>操作成功</b><br><br>
? ?<span id="s">5</span>秒后回到主頁 ?<span id="back" style="color:blue;text-decoration:underline;cursor:pointer">返回</span> ??
? <script type="text/javascript"> ?
?
? ?//獲取顯示秒數的元素,通過定時器來更改秒數。
? ?var time=5;
? ? var i = setInterval(function(){
? ? ? ? ? ? document.getElementById("s").innerHTML>1? document.getElementById("s").innerHTML= --time:window.location.href="www.xianlaiwan.cn"
? ? ? ? },1000);
? ?//通過window的location和history對象來控制網頁的跳轉。
? ?document.getElementById("back").onclick=function(){history.back();};
?</script>?
2015-12-19
>1? ...... : break;