Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我在故障排除期间使用了很多警报,而不是返回并删除它们,我宁愿将它们全部关闭?可以做到吗?也许通过重写`alert.prototype?
我想你需要类似的东西:
var oldAlert = window.alert; window.alert = function(){ if (enableAlertFunction){ oldAlert.apply(window,arguments); } }
enableAlertFunction是打开/关闭所有alert. 请记住在页面上的所有代码之前先运行此代码。
enableAlertFunction
alert