IE9上的确认对话框问题

时间:2013-07-12 13:42:05

标签: javascript confirm

使用如下确认框

if(! confirm("Are you sure?")){
                    return false;
                }else{
//Some code to execute
}

在按下对话框10-11后的“取消”按钮后,IE9上没有出现该框。 以前有人觉得这个问题吗?请给出一些想法来解决它

1 个答案:

答案 0 :(得分:-1)

我的结构会有所不同,因此代码不会在内存中徘徊。将其设置为var将确保如果再次单击它将被覆盖。

var response = confirm('Are you sure?');
if(response){ return false; }

// Do something here.

您在技术上不需要else {},因为return false将终止当前函数。