數(shù)字就是不跳轉(zhuǎn)
源代碼:
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對(duì)象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>? ?
?</head>
?<body>
? <!--先編寫好網(wǎng)頁布局-->
? <h2>操作成功</h2>
?<span id="second">5</span>
?秒后回到主頁
? <a href="javascript:bac();">返回</a>
? <script type="text/javascript"> ?
?? function set(){
??? var num=document.getElementById("second").innerHTML;
?????? num--;
?????? document.getElementById("second").innerHTML=num;
?? if(num==0){
????? window.location.assign("idcbgp.cn");
?? }
?? }
?? setInterval("set()",1000);
?? //獲取顯示秒數(shù)的元素,通過定時(shí)器來更改秒數(shù)。
?? //通過window的location和history對(duì)象來控制網(wǎng)頁的跳轉(zhuǎn)。
?? function bac{
?????? window.history.back();
?? }
?</script>
</body>
</html>
2015-12-15
我的數(shù)字也不會(huì)動(dòng),代碼和你的基本一樣
2015-12-12
?window.location.assign("idcbgp.cn");URL的格式不對(duì),應(yīng)該改成這樣window.location.assign("http://idcbgp.cn/");定義函數(shù)時(shí),少了一對(duì)括號(hào);
2015-11-29