作者:爱吃肉肉的狼 | 来源:互联网 | 2023-05-18 16:38
HowcanIfreezeJavascriptinfirebugsothaticaninspectthechangesmadebyitinthehtml?If
How can I freeze Javascript in firebug so that i can inspect the changes made by it in the html? If for example i have a jQuery rollover effect and i want to inspect the html code in that point in time.
如何在firebug中冻结Javascript,以便我可以在html中检查它所做的更改?例如,我有一个jQuery翻转效果,我想在那个时间点检查HTML代码。
I believe Dreamweaver CS4 has this feature titled freeze Javascript and live code. Is there a free equivalent either in Firebug or another Firefox extension?
我相信Dreamweaver CS4有这个名为freeze Javascript和live code的功能。在Firebug或其他Firefox扩展中是否有免费的等价物?
5 个解决方案
6
By "freeze" I assume you mean debugging, and yes, Firebug definitely has that.
通过“冻结”,我认为你的意思是调试,是的,Firebug肯定有这个。
First you have to go into the Script tab on Firebug. If Script is disabled on the site, enable it.
首先,您必须进入Firebug上的“脚本”选项卡。如果在站点上禁用了脚本,请启用它。
Now, go to the dropdown and select which Javascript file you want to debug. This is typically either the page itself with inline Javascript, or a linked page. Find the line of code you want to freeze on, and click to the left of the line numbers. You'll see a red dot appear - this dot denotes that the code will freeze there during execution. Once the code is there, you can access the current HTML by going to the "HTML" tab. You'll also see the icons in the top-right corner of Firebug's Script pane light up, allowing you to either continue execution, step over, step into, or step out of each line of code, observing HTML changes for each line executed.
现在,转到下拉列表并选择要调试的Javascript文件。这通常是具有内联Javascript的页面本身或链接页面。找到要冻结的代码行,然后单击行号左侧。你会看到一个红点出现 - 这个点表示代码将在执行期间冻结。代码存在后,您可以通过转到“HTML”选项卡来访问当前的HTML。您还会看到Firebug脚本窗格右上角的图标亮起,允许您继续执行,跳过,步入或逐步退出每行代码,观察每行执行的HTML更改。
Note that Firebug lets you step through code line-by-line, which means that minimized Javascript files (wherein all the code is compacted onto one line) are absolutely awful for debugging, because you can't tell where Firebug is. So for debugging purposes, I highly recommend getting the non-minimized versions of files.
请注意,Firebug允许您逐行逐步执行代码,这意味着最小化的Javascript文件(其中所有代码都压缩到一行)对于调试来说是非常糟糕的,因为您无法分辨Firebug的位置。因此,出于调试目的,我强烈建议您获取非最小化版本的文件。
If you need more help, I suggest checking out the Firebug documentation, which has some good guides.
如果您需要更多帮助,我建议您查看Firebug文档,其中包含一些很好的指南。