gpt4 book ai didi

javascript - prompt() 与 Internet Explorer 8

转载 作者:数据小太阳 更新时间:2023-10-29 04:31:23 25 4
gpt4 key购买 nike

我很难为我的问题找到解决方案。这是一个代码片段:

var ans = prompt("Mot de passe", '');
if (ans != '' && ans != null)
__doPostBack('__Page', ans);
else
window.location = "../Erreurs/NotAuthorized.aspx";

此代码在 Internet Explorer 9 上运行得非常好。但是我的客户端只在 Internet Explorer 8 上运行,所以我在 IE8 中使用 ieTester 对其进行了测试。但问题是提示不显示并且它会自动重定向,因为输入有一个空字符串 ('')。

那么我该如何解决这个问题才能与 Internet Explorer 8 一起使用呢?

最佳答案

IE 在 Internet 选项中有一个设置允许或拒绝 prompt()

IE prompt setting
(来源:adamhaskell.net)

默认情况下,在 IE8 中,此设置处于关闭状态。因此,对 prompt() 的调用将被忽略,并返回 ""

无论如何你都不应该使用prompt()。使用表格。

关于javascript - prompt() 与 Internet Explorer 8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10197147/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com