日期:2014-05-16  浏览次数:20359 次

关于 js 的位置问题。
本帖最后由 Opera_mini 于 2013-01-28 17:00:43 编辑

<html>
  <head>
    <title>Example Html Page</title>
  </head>
  <body>
    ......
  </body>
  <script type="text/javascript" src="example1.js"></script>
  <script type="text/javascript" src="example2.js"></script>
</html>

上面代码中</body>和</html>之间可以写js语句吗?就像我写得那样。
之前,我们一般都写在<body></body>之间。
javascript

------解决方案--------------------
没问题
有时这样写更好,会确保DOM对象都生成了
------解决方案--------------------
可以啊 写在哪里好就视情况而定了