当前位置: 代码迷 >> JavaScript >> JS无法加载到浏览器中。该如何解决
  详细解决方案

JS无法加载到浏览器中。该如何解决

热度:137   发布时间:2012-02-25 10:01:48.0
JS无法加载到浏览器中。
<html>
<head>
<title> 无标题文档 </title>
<script   language= "javascript ">
document.write( "欢迎来到javaScript世界 ");
</script>
</head>
<body>
<p> 尽情享受学习的快乐!!! </p>
</body>
</html>


这段代码在浏览器运行时无法运行 <script> </script> 标记中的内容。


------解决方案--------------------
放到 <body> </body> 之间
<html>
<head>
<title> 无标题文档 </title>

</head>
<body>
<script language= "javascript ">
document.write( "欢迎来到javaScript世界 ");
</script>
<p> 尽情享受学习的快乐!!! </p>
</body>
</html>
------解决方案--------------------
<html>
<head>
<title> 无标题文档 </title>
<script language= "javascript ">
document.write( "欢迎来到javaScript世界 ");
</script>
</head>
<body>
<p> 尽情享受学习的快乐!!! </p>
</body>
</html>
------------------------------
相当于

<html>
<head>
<title> 无标题文档 </title>
欢迎来到javaScript世界
</head>
<body>
<p> 尽情享受学习的快乐!!! </p>
</body>
</html>


在head标签里的文字不显示很正常啊~~~
  相关解决方案