简体   繁体   English

Javascript警报和确认在Windows 7的IE9中不起作用

[英]Javascript Alert and Confirm not working in IE9 on Windows 7

I have an Windows 7 machine with IE9 and Javascript is not disabled. 我有一台装有IE9的Windows 7计算机,未禁用Javascript。 However, when I use alert or confirm the browser just flickers twice and nothing happens. 但是,当我使用警报或确认浏览器只是闪烁两次而没有任何反应时。 This is not a code or validation issue as the code works fine in Chrome, Firefox, Opera and Safari. 这不是代码或验证问题,因为该代码在Chrome,Firefox,Opera和Safari中可以正常工作。 I checked the console and there are no errors. 我检查了控制台,没有错误。

Does anybody know if there is a way to specifically affect these specific JavaScript functions with some setting? 有人知道是否可以通过某种设置来具体影响这些特定的JavaScript函数吗? To add more confusion, the prompt function does work, just not alert and confirm. 更令人困惑的是,提示功能确实起作用,只是没有提醒和确认。

eg this code sample fails to show an alert. 例如,此代码示例无法显示警报。

<script>
  alert('hello');
  document.write('done');
  document.close();
</script>

There are no add-ons and there is no popup blocker 没有附加组件,没有弹出窗口阻止程序

I know this question is OLD but I just had the same problem and found my answer in another post around here so I thought someone else might benefit from this. 我知道这个问题很旧,但是我也遇到了同样的问题,并且在附近的另一篇文章中找到了答案,所以我认为其他人可能会从中受益。

Open up the IE developer tool (F12) after your page is loaded. 加载页面后,打开IE开发人员工具(F12)。

Check the Browser Mode: and Document Mode: 检查浏览器模式:和文档模式:

Try setting Browser Mode to IE9, and Document Mode to IE9 Standards. 尝试将浏览器模式设置为IE9,将文档模式设置为IE9标准。

Now try again and see if that works. 现在重试,看看是否可行。

The original answer. 原始答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM