javascript 使用 firebug 查找 js 函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5469691/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Find js function with firebug
提问by hhh3112
I have the following button:
我有以下按钮:
<input type="submit" id="btnLogin" onclick="return ValidateLogin();" value="Enter">
How can i find the definition of the ValidateLogin() function with firebug?
如何使用 firebug 找到 ValidateLogin() 函数的定义?
回答by Chris
Type the following into the Firebug Console, then click the function() in the output window
在 Firebug 控制台中键入以下内容,然后单击输出窗口中的 function()
var s = ValidateLogin.prototype.constructor;
console.log(s); // will output the actual function definition
I have included some screenshots to help.
我提供了一些屏幕截图来提供帮助。
回答by Philipp Rieber
To get the function definition only this would be a shortcut in the firebug console:
要仅获取函数定义,这将是 firebug 控制台中的快捷方式:
console.log(ValidateLogin.toString());
The defintion of the function will be printed to the console directly.
函数的定义会直接打印到控制台。
回答by RoToRa
There is a search field on the top right of Firebug. When you are on the Script panel and focus the search field, you'll get a small dialog which a check box "Multiple Files" (or something similar - I don't have the English version). Check it and copy the name of the Function you are looking for into it.
Firebug 的右上角有一个搜索字段。当您在脚本面板上并聚焦搜索字段时,您会看到一个小对话框,其中有一个复选框“多个文件”(或类似的东西 - 我没有英文版本)。检查它并将您要查找的函数的名称复制到其中。
回答by Faber
go to HTML label. Here you can view also the contents of the Javascript file included in the page.
转到 HTML 标签。您还可以在此处查看页面中包含的 Javascript 文件的内容。
I hope it's helpful.
我希望它有帮助。