【问题标题】:Confirm box on drag and release opens duplicate confirm box in IE11拖放确认框会在 IE11 中打开重复的确认框
【发布时间】:2015-04-12 18:57:33
【问题描述】:

我有一个使用下面给出的 javascript 代码创建的确认框。获得确认框后,如果我使用鼠标拖动它并离开它,它会打开一个新的确认框,之前的确认框也在 IE11 中打开。因此,这样做不断打开这么多的确认框。但它在 IE8 中运行良好。请建议如何处理这个问题。是 IE11 的 bug 吗?

<!DOCTYPE html>
<html>
<body>

<p>Click the button to display a     confirm box.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction() {
var txt;
var r = confirm("Press a button!");
if (r == true) {
    txt = "You pressed OK!";
} else {
    txt = "You pressed Cancel!";
}            
     document.getElementById("demo").innerHTM    L = txt;
}
</script>

【问题讨论】:

  • 可能是你的 IE 的 bug。

标签: javascript html web-applications internet-explorer-11


【解决方案1】:

查看您在使用此link 时是否出现问题?如果是这样,则很可能是您特定版本的 IE 中的错误:

function func() {
    var txt;
    var r = confirm("Press a button!");
    if (r == true) {
        txt = "You pressed OK!";
    } else {
        txt = "You pressed Cancel!";
    }
    document.getElementById("demo").innerHTML = txt;
}

【讨论】:

    猜你喜欢
    • 2014-02-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-18
    • 2021-08-07
    • 1970-01-01
    相关资源
    最近更新 更多