這個(gè)代碼為什么不執(zhí)行返回操作?
</body><!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對(duì)象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? ? ?<!--先編寫好網(wǎng)頁(yè)布局-->
? ? ?<h1>操作成功!</h1>
? ? ?<p><span id="seconds">5</span>秒后回到主頁(yè)
? ? ?<a href="javascript:open();">返回</a></p>
? ? ?
? ? ?<script type="text/javascript"> ?
? ? ?//獲取顯示秒數(shù)的元素,通過(guò)定時(shí)器來(lái)更改秒數(shù)。
? ? ?//通過(guò)window的location和history對(duì)象來(lái)控制網(wǎng)頁(yè)的跳轉(zhuǎn)。
? ? ?var intervalTime = 5000;
? ? ?var frq = 1000;
? ? ?var t = intervalTime / frq;
? ? ?
? ? ?function open(){
? ? ? ? ?if(window.history.length==0){
? ? ? ? ? ? ?location.assgin("www.baidu.com");
? ? ? ? ?}
? ? ? ? ?else{
? ? ? ? ? ? ?window.history.go(-1);
? ? ? ? ?}
? ? ? ? }
? ? ?
? ? ?function countdown(){
? ? ? ? ?if(t==0){
? ? ? ? ? ? ?open();
? ? ? ? ?}
? ? ? ? ?else{
? ? ? ? ? ? ?t = t - 1;
? ? ? ? ? ? ?document.getElementById("seconds").innerHTML = t;
? ? ? ? ?}
? ? ? ? }
? ? ?//間隔函數(shù)
? ? ?setInterval(countdown, frq);
? ? ?
? ? ?
?</script>?
? ??
</body>
</html>
</html>
2015-10-23
location.assign中assign?寫成assgin,還用要寫完整的URL:http://www.baidu.com
2015-09-21
瀏覽器進(jìn)入開發(fā)者工具,看一下有沒(méi)有報(bào)錯(cuò)信息