為什么無(wú)法跳轉(zhuǎn)網(wǎng)頁(yè)?倒計(jì)時(shí)5秒后就空白了
<html>
?<head>
? <title>瀏覽器對(duì)象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <!--先編寫(xiě)好網(wǎng)頁(yè)布局-->?
? <h3>操作成功</h3>
? <p><span id=daoshu>5</span>秒后回到主頁(yè)<input type=button value="返回" onclick="window.history.back()" /></p>
?
? <script type="text/javascript">
? var sum=4;
? function dao(){
? ? document.getElementById("daoshu").innerHTML=sum;
? ? sum--;
? }
? ? ? setInterval("dao()",1000);
? ?//獲取顯示秒數(shù)的元素,通過(guò)定時(shí)器來(lái)更改秒數(shù)。?
? setTimeout("window.location.assign('idcbgp.cn')",5000);
? ?//通過(guò)window的location和history對(duì)象來(lái)控制網(wǎng)頁(yè)的跳轉(zhuǎn)。 ?
? ?
?</script>?
</body>
</html>
2018-06-18
?setTimeout("window.location.assign('idcbgp.cn')",5000);?,把idcbgp.cn改成http:://idcbgp.cn
2018-06-13
把代碼復(fù)制到自己編輯器上保存,用瀏覽器打開(kāi)試試,慕課有時(shí)候編輯器有點(diǎn)。。。