為什么document.write無效
<!DOCTYPE html>
<html>
?<head>
? <title>瀏覽器對象</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);//為什么這個不顯示了?????
? ? </script>?
?</head>
?<body>
? <!--先編寫好網(wǎng)頁布局-->
? <h1>計時頁面開始</h1>
? <p><strong id="clock">5</strong>秒后返回主頁<a href="javascript:goback();">返回</a></p>
</body>
</html>
2018-02-01
我發(fā)現(xiàn)了問題,啊,西八 這個語言簡直是太不規(guī)范了!?。。。。。。。。。。。?!
所有的量應(yīng)該先定義,再使用。strong id = clock在下面,所以拿不到那個數(shù)??!
但是function在前面定義的話,貌似后面就可以使用?。。。。。。。。?!