0

我正在使用如下的确认框

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

在我按下对话框 10-11 上的“取消”按钮后,该框未出现在 IE9 上。有没有人有过这个问题??请提供一些想法来解决它

4

1 回答 1

-1

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

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

// Do something here.

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

于 2013-07-12T13:45:59.870 回答