本輪測試問題答案
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title>
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
?</head>
?<body>
? <!--先編寫好網頁布局-->
? <h1>操作成功</h1>
? <p><span id="a">5</span>秒后返回主頁</p><a href="javascript:return()">返回</a>
? <script type="text/javascript">
? ?var num=4;
? ?var i=setInterval(colick,1000);//獲取顯示秒數的元素,通過定時器來更改秒數。
? ?function colick(){
? ?var sp=document.getElementById("a");//通過window的location和history對象來控制網頁的跳轉
? ? ? ?if(num<0){
? ? ? ? ? ?clearInterval(i);//取消計時器并實現跳轉
? ? ? ? ? ?location.assign("http://www.xianlaiwan.cn");
? ? ? ?}else{
? ? ? ?sp.innerHTML=num;
? ? ? ?num=num-1;
? ?}
? ?}
? ?function retrun(){
? ? window.history.back();
? ?}
?</script>
</body>
</html>
2019-10-17
在調試的時候大家要把跳轉頁面的語句給注釋掉哦~