我在 Dreamweaver 中有一个 image.html 文件。
在源代码中,我链接了一个名为 img.js 的 js 文件
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>PHOTO</title>
<script language="javascript" type="text/javascript" src="js/img.js"></script>
</body>
</html>
如果在 img.js 中使用警报
alert("My First Jquery Test");
它在网页中正确显示,但如果编写一些 javascript 代码,例如
<html>
<body>
<p id="p2">Hello World!</p>
<script>
document.getElementById("p2").style.color="blue";
</script>
上面的段落被脚本改变了。
什么都没有显示..为什么以及如何显示这个?