Javascript Html页面未执行java脚本
这是一个简单的hello world java脚本,通过单独的js文件在html中引用。html的视图页面Src显示以下内容:Javascript Html页面未执行java脚本,javascript,Javascript,这是一个简单的hello world java脚本,通过单独的js文件在html中引用。html的视图页面Src显示以下内容: <html> <head> <script type="text/javascript" src="HelloWorld.js"></script> </head> </html> HelloWorld.js: <html> <head
<html>
<head>
<script type="text/javascript" src="HelloWorld.js"></script>
</head>
</html>
HelloWorld.js:
<html>
<header>
<script language="javascript" type="text/javascript">
document.write("Hello World!");
</script>
</header>
</html>
写下“你好,世界!”;
但当我双击html文件时,浏览器中不会显示Hello World。删除js文件中的html、标题和脚本标记
document.write("Hello World!");
您的js文件包含HTML
<html>
<header>
<script language="javascript" type="text/javascript">
document.write("Hello World!");
</script>
</header>
</html>
HelloWorld.js
包含HTML。它只需要包含JavaScript。是的,那么它就可以工作了。也不应该使用标签。
document.write("Hello World!");