【问题标题】:Is there an "all alerts off" script that will disable all alerts?是否有会禁用所有警报的“所有警报关闭”脚本?
【发布时间】:2013-10-04 18:35:18
【问题描述】:

假设我在故障排除期间使用了大量警报,而不是返回并删除它们,我宁愿将它们全部关闭?可以做到吗?也许通过重写`alert.prototype?

【问题讨论】:

标签: javascript prototype alert


【解决方案1】:

我猜你需要类似的东西:

var oldAlert = window.alert;

window.alert = function(){
   if (enableAlertFunction){
      oldAlert.apply(window,arguments);
   }
}

enableAlertFunction 是打开/关闭你所有的alert。请记住在页面上的所有代码之前先运行此代码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-13
    • 2014-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多