为什么以下 HTML 中没有出现警报?
我的 HTML
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="a.js"/>
</head>
<body>
</body>
<html>
a.js
alert("hello");
最佳答案
您不能有自关闭脚本标记。将脚本标签更改为:
<script src="a.js"></script>
关于javascript - 为什么外部JS的alert没有出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30825429/