How to edit JavaScript in Firebug?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 17:43:06

问题


I am only able to view the JavaScript files of the website via the Script panel. How can I edit it? I tried everything like double clicking the line that i want to edit etc., but it doesn't let me edit it.

If I move to the HTML tab, I am able to edit the HTML by clicking on the Edit button, but I am not able to edit the JavaScript.


回答1:



(source: fidelitydesign.net)

You can use the Firebug Console tab to write Javascript. I use this quite a lot of rapid prototyping of code before I integrate it into my projects. When you use the Console, javascript is executed in the context of the current page. Therefore, and scripts that are currently defined for that page, can potentionally be redefind. E.g., in the Console window, I could do this:

$ = function() { alert("Whoops"); }

...and that would redefine the $ function used by JQuery.




回答2:


There is a "Scratchpad" built into the Mozilla framework. This can be reached from within Firefox.

In the "Tools" menu under "Web Developer"->"Scratchpad".

Or...

Just right click on any element on your page. Select "inspect element" On the inspector toolbar, far to the right, there is a noteblock "Scratchpad", press it.

Now you get a Javascript editor with syntax highlightning etc.. From here you can open/save your javascript source file.

Read more bout it here.




回答3:


As far as I know only Chrome's dev tools support editing JavaScript inside their Sources tab (not just via the command line). And you can add an extension like Tincr or DevTools Autosave and Chrome will save the changes to your JavaScript files on the disk. So it is pretty much a complete IDE for JavaScript.

Otherwise if you are using Firebug, you would have to test your code in the Command Editor, then open your text editor and open that file you were looking in Firebug and then add those changes inside your text editor and save.

I hope that one day they will enable JavaScript to be editable inside the Script panel of Firebug.




回答4:


In the Firebug console, you can type in new javascript. So just redefine functions or variables as needed through that.




回答5:


You can't do it. You should use javascript console to redefine functions.




回答6:


You can also use fiddler.
I use it and it has worked out for me pretty well.



来源:https://stackoverflow.com/questions/3203779/how-to-edit-javascript-in-firebug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!