請(qǐng)問錯(cuò)哪里了
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對(duì)象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <!--先編寫好網(wǎng)頁布局-->
? <p>操作成功</p>
?<span id="a">5</span>
?<span>秒后回到主頁<a href="javascript:history.back()">返回</a></span>
?
? <script type="text/javascript"> ?
? var num=document.getElementById("a").innerHTML;
? ?//獲取顯示秒數(shù)的元素,通過定時(shí)器來更改秒數(shù)。
function b(){
? ? num--;
? ? document.getElementById("a").innerHTML=num;
? ? if(num==0){
? ? ? ? window.location.assign(""idcbgp.cn");
? ? }
? ? setInterval("b()",1000);
}
function c(){
? ? window.history.back();
}
? ?//通過window的location和history對(duì)象來控制網(wǎng)頁的跳轉(zhuǎn)。
? ?
?</script>?
</body>
</html>
2015-12-12
?window.location.assign(""idcbgp.cn");這一段代碼應(yīng)該多了一個(gè)雙引號(hào),而且路勁URL格式不對(duì),應(yīng)該是這樣?window.location.assign("http://idcbgp.cn/");
2015-12-12
肯定錯(cuò)啦,不能運(yùn)行啊,你要把setInterval("b()",1000);這一段代碼放在函數(shù)外面,不然,你只是定義了函數(shù),沒有調(diào)用
2015-12-07
而且要想運(yùn)行,必須在body的onload事件中加載b()
2015-12-07
if(num==0){
? ? ? ? window.location.assign(""idcbgp.cn");
? ? }
www前多了個(gè)雙引號(hào),刪掉個(gè)就好了