随着任何Javascript被执行,告诉Firebug即将破解 [英] Telling Firebug to Break as Soon as any Javascript is Executed

查看:90
本文介绍了随着任何Javascript被执行,告诉Firebug即将破解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我点击一些< button> 元素时,我已经继承了一堆代码,这些代码是意想不到的。

I've inherited a pile of code that's doing unexpected things when I click on some <button> elements.

该页面有很多Javascript,目前尚不清楚按钮或其父元素上已经设置了什么事件(如果有的话)。我试图找到执行开始的位置,所以我可以调试发生了什么。

The page has a lot of Javascript, and it's unclear what, if any, events have been setup on the button or its parent elements. I'm trying to find where execution starts so I can debug what's going on.

有没有办法让Firebug(或任何Javascript调试器)每当任何 JavaScript代码执行?有可能要在每行上以编程方式设置断点?或者还有其他方法来找出按钮响应的事件(页面用户boh Prototype,jQuery和一些自定义Javascript,我知道。)

Is there a way to have Firebug (or any Javascript debugger) break whenever any javascript code is executed? Maybe someway to setup a break point on each line programmatically? Or is there some other way to find out which event the button is responding to (page users boh Prototype, jQuery, and some custom Javascript. I know.)

推荐答案

只需按下Firebug面板上的暂停按钮(在其左上角,两条黄色垂直线,当选择脚本选项))时,它将在第一个JS字符串停止。

Just press Pause button on the firebug panel (on the left-top corner of it, two yellow vertical lines, when Script tab selected) - and it will stops at first JS string.

但是它会阻止JS在任何事件中执行 - 所以如果你有一个按钮捕获鼠标移动和鼠标点击 - 我将无法停止鼠标点击,因为脚本将每次尝试将鼠标移到该按钮上时,都可以在鼠标移动时停止。我建议你只是在可疑的地方插入alert() - 经过一些迭代,你会发现你需要的字符串(发生错误)。

But it will stop JS executing really at ANY event - so if you have a button which catches mouse move and mouse click - i will not be able to stop on mouse click, since script will be stopped at mouse move each time you try to move mouse over this button. I suggest you just to insert alert()'s in the suspicious places - after some iterations you will found exactly string you need (where error occurs).

这篇关于随着任何Javascript被执行,告诉Firebug即将破解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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