禁用alert(); [英] Disable alert();

查看:202
本文介绍了禁用alert();的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法控制的页面上生成的代码包含警报。有没有jQuery或其他方法来禁用alert()工作?

Code that is generated on my page that I cannot control contains an alert. Is there a jQuery or other way to disable alert() from working?

我想要禁用/修改的javascript是:

The javascript that is being generated that I want to disable/modify is:

function fndropdownurl(val)
1317 { var target_url
1318 target_url = document.getElementById(val).value;
1319 if (target_url == 0)
1320 {
1321 alert("Please Select from DropDown")
1322 }
1323 else
1324 {
1325 window.open(target_url);
1326 return;
1327 }
1328 } 

我想在第1321行禁用警报

I want to disable the alert on line 1321

谢谢

推荐答案

只需覆盖提醒使用您自己的空函数。

Simply overwrite alert with your own, empty, function.

window.alert = function() {};

// or simply
alert = function() {};

这篇关于禁用alert();的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆