為什么不會倒計時,也不能返回上一網址?
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <!--先編寫好
網頁布局-->
?
?<h1>操作成功!<br></h1>
? <b id="scecound">5</b>秒后返回主頁 ?
<a ?href="javascript:goBack()">返回</a>
? <script type="text/javascript"> ?
?
//獲取顯示秒數的元素,通過定時器來更改秒數。
var i=document.getElementById("scecound");//獲取元素
var e=5;
? ?//使用計時器
var time=setInterval(function(){
var i=document.getElementById("scecound");//獲取元素 ??
?e--;
i.innerHtml=e;
if(i==0){
?window.location.href="http://www.xianlaiwan.cn/";
?}
?},1000);
??
?//通過window的location和history對象來控制網頁的跳轉。
?function goBack(){
? ? ? ?window.location.forward();
? ?}
?
</script>
?
</body>
</html>
2019-05-23
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>? ?
?</head>
?<body>
? <!--先編寫好網頁布局-->
?<h3>操作成功</h3>? <p>
? ? <span id="time">5</span>秒后回到主頁 <a href="javascript:goBack();">返回</a>
?</p>
?
?<script type="text/javascript">??
//? ?獲取顯示秒數的元素,通過定時器來更改秒數。
? ? ?var love = document.getElementById("time");
var i=5;
? var sexy=setInterval(function(){
? i--;
? ? love.innerHTML=i;
? if(i==1)
? {
window.location.;??
? }
? },1000)
? function goBack(){
? window.history.go(-1);
? }
</sricpt>
2019-04-19
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>? ?
?</head>
?<body>
? <!--先編寫好網頁布局-->
? <h3>操作成功</h3>
<span id="second" >5</span>
? <span>秒后回到主頁</span>
? <a href="javascript:back()">返回</a>
? <script type="text/javascript">??
? ? var num=document.getElementById("second").innerHTML;
? ?//獲取顯示秒數的元素,通過定時器來更改秒數。
??
? ? function count()
? ? {
? ? ? ? num--;
? ? ? ? document.getElementById("second").innerHTML=num;
? ? ? ? if(num==0)
? ? ? ? {
? ? ? ? ? ? location.assign("www.xianlaiwan.cn");
? ? ? ? }
? ? }
? ? setInterval("count()",1000);
? ?//通過window的location和history對象來控制網頁的跳轉。
? ? function back()
? ? {
? ? ? ?window.history.back();
? ?}
? ?
?</script>?
</body>
</html>
2019-03-18
??window.location.forward();???????????不是back??
2019-03-05
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <!--先編寫好網頁布局-->
?
?<h1>操作成功!<br></h1>
?<span id="scecond">5</span><span>秒返回到主頁</span><a ?href="javascript:goBack()">返回</a>
? <script type="text/javascript"> ?
?var e=5;
//獲取顯示秒數的元素,通過定時器來更改秒數。
? ?//使用計時器
var time=setInterval(function (){
?document.getElementById("scecond").innerHTML=e;//獲取元素 ??
?e--;
if(e==0){
window.location.href="http://www.xianlaiwan.cn/";
clearInterval(time);?
?}
?},1000);
??
?//通過window的location和history對象來控制網頁的跳轉。
??
?function goBack(){
? ? ? ?window.location.forward();
? ?}
?
</script>
?
</body>
</html>
找到原因了!賦值出現了問題!
2019-03-05
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <!--先編寫好網頁布局-->
?
?<h1>操作成功!<br></h1>
? <span id="scecond">5</span>秒后返回主頁 ?
<a ?href="javascript:goBack()">返回</a>
? ? ?
??
?
? <script type="text/javascript"> ?
?
? ?
//獲取顯示秒數的元素,通過定時器來更改秒數。
??
var e=5;
? ?//使用計時器
? ?
var time=setInterval(function(){
? ?
?e=document.getElementById("scecond".innerHTML;//獲取元素 ??
?e--;
if(i==0){
? ? ? ? ?
window.location.href="http://www.xianlaiwan.cn/";
clearInterval(time);?
?}
?},1000);
??
?//通過window的location和history對象來控制網頁的跳轉。
??
?function goBack(){
? ? ? ?window.location.forward();
? ?}
?
</script>
?
</body>
</html>
改成這個樣子還是不對