用sublime編輯后,會出現(xiàn)保存html代碼的保存位置這么辦?具體看下面
<html> <head> <title>流浪器對象</title> <meta?http-equiv="Content-type"?content="text/html;charset=utf-8"/> </head> <body> <!--想編號網(wǎng)頁布局--> <h1>操作成功</h1> <span?id?="second"?>5</span> <span>秒后回到主頁</span> <a?href?=?"javascript:history.back();"?target?="_blank">返回</a> <script?type?="text/javascript"> var?num=document.getElementById("second").innerHTML; //獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。 function?count(){ num--; document.getElementById("second").innerHTML=num; if(num==0){ location.assign("idcbgp.cn"); } } setInterval("count()",1000); //通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。 function?back(){ window.history.back(); } </script> </body> </html>
我保存在E盤,程序運行正常,然后跳轉(zhuǎn)到了file:///E:/idcbgp.cn怎么搞??
2016-04-08
加上http://也可以,location.assign("http://idcbgp.cn");
2016-04-08
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>? ?
?</head>
?<body>
? <!--先編寫好網(wǎng)頁布局-->
? <h3>操作成功</h3>
? <span id="fh"></span>秒后回到主頁
? <a href="javascript:window.history.back()">返回</a>
?
?
? <script type="text/javascript"> ?
?
?? //獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
??? var i = 5;
??? var a = document.getElementById("fh");
??? setInterval("timer()",1000);
?? //通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。
?? function timer(){
??????? if(i == 0){
??????????? window.location.href=window.history.back();
??????? }else{
??????????? a.innerHTML=i; ?
??????????? i--;
??????? }
??? }
???? ?
? ?
?</script>
</body>
</html>
2016-04-08
不是吧,這是你的代碼,我這里正常。
<html>
??? <head>
??? <title>流浪器對象</title>
??? <meta http-equiv="Content-type" content="text/html;charset=utf-8"/>
??? </head>
<body>
??? <!--想編號網(wǎng)頁布局-->
??? <h1>操作成功</h1>
??? <span id ="second" >5</span>
??? <span>秒后回到主頁</span>
??? <a href = "javascript:history.back();" target ="_blank">返回</a>
??? <script type ="text/javascript">
??? var num=document.getElementById("second").innerHTML;
??? //獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
??? function count(){
??????? num--;
??????? document.getElementById("second").innerHTML=num;
??????? if(num==0){
??????????? location.assign("http://idcbgp.cn");
??????????? // window.location.href =? "http://idcbgp.cn/";
??????? }
??? }
??? setInterval("count()",1000);
??? //通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。
??? function back(){
??????? window.history.back();
??? }
??? </script>
</body>
</html>
2016-04-08
location.assign()??? 是加載新的文檔。是file
改成:location.href =? "http://idcbgp.cn/";