我已经验证了这个 html。当我在 IE 浏览器中打开它时,我看不到任何警报。在其他浏览器中我可以。任何想法为什么会这样。 HTML 根据 http://validator.w3.org/check 有效.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>hello</title>
</head>
<body>
<script type="text/javascript">alert("hallo");</script>
<div>Hello</div>
</body>
</html>
最佳答案
如果您在 IE 中本地打开文件,您将收到来自 IE 的查找确认消息
"Allow blocked content"
点击它,您的代码就会运行。
关于javascript - IE 忽略了我的 js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17343179/