求問(wèn),這個(gè)怎樣自動(dòng)跳轉(zhuǎn)啊
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對(duì)象</title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>? ?
?</head>
?<body>
? <!--先編寫(xiě)好網(wǎng)頁(yè)布局-->
? <h2>操作成功</h2>
? <p><span id="opp">5</span>秒后回到主頁(yè) <a href="javascript:tzn();">返回</a></p>
??
? <script type="text/javascript">
? var num=5;
? var opp1=document.getElememtById("opp");
? function zid()
? {
? ? ? num=num-1;
? ? ? opp1.innerHTML=num;
? ? ? if(num==0)
? ? ? {
? ? ? ? ? window.open('http://idcbgp.cn','_blank');
? ? ? }
? ? ? setTimeout("zid()",1000);
? }//獲取顯示秒數(shù)的元素,通過(guò)定時(shí)器來(lái)更改秒數(shù)。
?
? ?//通過(guò)window的location和history對(duì)象來(lái)控制網(wǎng)頁(yè)的跳轉(zhuǎn)。
? ?function tzn()
? ?{
? ? ? ?location.assign(window.history.go(-1));
? ?}
?</script>?
</body>
</html>
2020-02-13
額,知道了 拼錯(cuò)了