為什么按跳轉(zhuǎn),沒有反應(yīng)???
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/> ??
?</head>
?<body>
? <!--先編寫好網(wǎng)頁布局-->
? <p><span id="time">5</span>秒后跳轉(zhuǎn)頁面<a href="javascript:tiaozhuan()">跳轉(zhuǎn)</a></p>
??
? <script type="text/javascript"> ?
?
? ?//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
? ?//倒計時.
var num=5;
? ? function daojishi()
? ? {
? ??
? ? ? ? document.getElementById("time").innerHTML=num;
? ? ? ? num=num-1;
? ? ? ? if(num==0)
? ? ? ? {
? ? ? ? ?location.;
? ? ? ? }
? ? }
? ? setInterval("daojishi()",1000);
? ?//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。
? ?function tiaozhuan()
? ?{
? ? ? ?
? ? ? ?window.history.back() ;
? ?}
?</script>?
</body>
</html>
2018-04-17
location.href 使用 window.open('http://youku.com','_blank')