javascript - IE 忽略了我的 js

标签 javascript internet-explorer

我已经验证了这个 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/

相关文章:

java - 在 javascript 中处理 POJO

jquery - jcarousel 或任何其他类似的图像 slider

css - Internet Explorer-> <DIV> & 宽度

javascript - .getDay() 在 IE 和 Safari 中不起作用

javascript - 使用正则表达式替换/删除 IP 地址

javascript - 带有 PHP 的 wordpress 自定义 html 小部件

javascript - 如何在相机 Cordova/Phonegap 上显示文字?

javascript - 通过 JavaScript 切换按钮上的图标

internet-explorer - Selenium IE 更改事件未触发

javascript - 如何通过 JavaScript 在 Internet Explorer 11 中仅收集数组中的唯一值?