為什么document.write無(wú)效
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對(duì)象</title>??
? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
? ? <script type="text/javascript">??
? ? ? ? function sss(){
? ? ? ? ? ? window.location.assign("https://www.baidu.com");
? ? ? ? }
? ? ? ? function goback(){
? ? ? ? ? ? window.history.back();
? ? ? ? }
? ? ? ??
? ? ? ? var seconds = parseInt(document.getElementById("clock").innerHTML);
? ? ? ? document.write(seconds);//為什么這個(gè)不顯示了?????
? ? </script>?
?</head>
?<body>
? <!--先編寫好網(wǎng)頁(yè)布局-->
? <h1>計(jì)時(shí)頁(yè)面開(kāi)始</h1>
? <p><strong id="clock">5</strong>秒后返回主頁(yè)<a href="javascript:goback();">返回</a></p>
</body>
</html>
2018-02-01
我發(fā)現(xiàn)了問(wèn)題,啊,西八 這個(gè)語(yǔ)言簡(jiǎn)直是太不規(guī)范了?。。。。。。。。。。。。?!
所有的量應(yīng)該先定義,再使用。strong id = clock在下面,所以拿不到那個(gè)數(shù)!!
但是function在前面定義的話,貌似后面就可以使用!?。。。。。。。?!