為什么一直顯示這兩個(gè)函數(shù)不存在
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對(duì)象</title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>?
? <script type="text/javascript">??
? ? var currentUrl=location.href;
? ? console.log(currentUrl);
? ? //獲取顯示秒數(shù)的元素,通過(guò)定時(shí)器來(lái)更改秒數(shù)。
? ? function showChangeTime(){
? ? ? ? //跳轉(zhuǎn)到 https://www.baidu.com 頁(yè)面的函數(shù)
? ? ? ? function goTo(){
? ? ? ? ? window.open('https://www.baidu.com','百度','width=600,height=500');
? ? ? ? ? document.write('操作成功!');
? ? ? ? }
? ? ? ? setTimeout('goTo',5000);
? ? ? ? //顯示倒計(jì)時(shí)的函數(shù)
? ? ? ? var num=5;
? ? ? ? function changeTime(){??
? ? ? ? ? ? var timgHtml=document.getElementById('time');
? ? ? ? ? ? ? ? timgHtml.innerHtml('num');
? ? ? ? ? ? ? ? num--;? ? ? ?
? ? ? ? ? }
? ? ? ? ? i=setInterval('changeTime()',1000);
? ? ? ? ? if(num==1){
? ? ? ? ? ? clearInterval(i);
? ? ? ? ? }?
? ? ? }
? ? ? ? //返回到當(dāng)前頁(yè)面
? ? ? ? function backCurrent(){? ? ? ?
? ? ? ? ? history.go(-1);
? ? ? }
? ? ? showChangeTime();
? ?
? ?
?</script>? ?
?</head>
?<body>
? <!--先編寫(xiě)好網(wǎng)頁(yè)布局-->
? <p><span id="time"></span> 秒后回到主頁(yè)<a href="#" id="toBaidu" onclick="backCurrent()">返回</a></p>
??
?
??
</body>
</html>
2018-11-26
主函數(shù)體內(nèi)有一些錯(cuò)誤,提示函數(shù)不存在的話可以改用匿名函數(shù)方式實(shí)現(xiàn)
2018-11-06
邏輯有問(wèn)題。