如何预防,停止或终止Javascript功能? [英] How do I prevent, stop, or kill Javascript function?

查看:68
本文介绍了如何预防,停止或终止Javascript功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何防止此Javascript函数执行。

How do I prevent this Javascript function from executing.

我有一个导致严重问题的js函数,我无法删除或修改它。我想知道是否可以简单地阻止,停止或终止该功能,以便在我解决问题之前不执行该功能。

I have a js function that is causing a serious issue and I am not able to remove nor modify it source. I would like to know if it is possible to simply prevent, stop, or kill the function in order that it is not executed till I resolve the issue.

所以在某处内部页面:

<script type="text/javascript"><!--
problem_func();
//--></script>

我想要的就是停止执行该功能,在头部或外部js内放置一个塞子。

And all I want is to stop that function from execution placing a stopper inside the header or external js.

有什么建议吗?

这里是现场示例,如何停止? http://jsbin.com/uxalag/3

HERE IS THE LIVE EXAMPLE, HOW TO STOP THAT? http://jsbin.com/uxalag/3

推荐答案

如果您知道函数名称,则可以将其替换为不执行任何操作的函数。
在源js文件的脚本标记之后使用:

If you know the function name, you can replace it with a function that does nothing. After the script tag of the source js file use this:

window.FunctionName=function(){return false;};

这篇关于如何预防,停止或终止Javascript功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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