寫(xiě)不出來(lái),求牛牛幫忙改正一下代碼,謝謝
<!--先編寫(xiě)好網(wǎng)頁(yè)布局-->
??
? <div>
? ? ? <p>操作成功!</p>
? ? ? <p><span id="Num">_num</span>秒后回到主頁(yè)<a href="#" onClick="_back()">返回</a></p>
? </div>
?
? <script type="text/javascript"> ?
?
?function _href(){
? ? ?window.location.href = http://idcbgp.cn/code/1633;
? ??
?}
?setTimeout("_href()",5);
? ?//獲取顯示秒數(shù)的元素,通過(guò)定時(shí)器來(lái)更改秒數(shù)。
? ?var _num = 5;
? ? ? ?_num --;
function _back(){
? ? ?window.history.back();
?}
?if(_num==0){
? ? ?_back();
?}
? ?//通過(guò)window的location和history對(duì)象來(lái)控制網(wǎng)頁(yè)的跳轉(zhuǎn)。
? ?
2017-03-28
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對(duì)象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>?
?</head>
?<body>
? <!--先編寫(xiě)好網(wǎng)頁(yè)布局-->
? <h1>操作成功</h1><br />
? <span id="l" >5</span>
? <lable ?>秒后返回到主頁(yè)</lable>
? <a href="javascript:goBack()" value="返回">返回</a>
? <script type="text/javascript"> ?
? ?//獲取顯示秒數(shù)的元素,通過(guò)定時(shí)器來(lái)更改秒數(shù)。
? ?var num=5;
? ?var i;
? ?function getS(){
? ? ? ?document.getElementById("l").innerHTML=num;//通過(guò)innerHTML對(duì)標(biāo)簽賦值
? ? ? ?num=num-1;
? ? ? ?if(num==0){
? ? ? ? clearTimeout(i);
? ? ? ? location.assign("http://idcbgp.cn");//location.assign跳到一個(gè)新的頁(yè)面
? ? ? ?}else{
? ? ? ? ?var i= setTimeout(getS,1000);?
? ? ? ?}
? ?}
? ?setTimeout(getS,1000);
? ?//通過(guò)window的location和history對(duì)象來(lái)控制網(wǎng)頁(yè)的跳轉(zhuǎn)。
? ? function goBack(){
? ? ? ? history.back();
? ? }
? ?
?</script>?
</body>
</html>
2017-03-28
function _href(){
? ?window.location.href =" "
}
setTimeout("_href()",5000);
//獲取顯示秒數(shù)的元素,通過(guò)定時(shí)器來(lái)更改秒數(shù)。
var _num = 5;
_num --;
function _back(){
? ?window.history.back();
}
if(_num==0){
? ?_back();
}