Home > Web Front-end > JS Tutorial > js WEB development and debugging tool: Firebug download_basic knowledge

js WEB development and debugging tool: Firebug download_basic knowledge

WBOY
Release: 2016-05-16 19:20:46
Original
1085 people have browsed it

米随随的Blog看到有关Firebug的介绍,遂下载试用了一下,确实是比较好的工具。

一、效果
firebug demo

二、主要功能

  • Inspect and edit HTML
  • Tweak CSS to perfection
  • Visualize CSS metrics
  • Monitor network activity
  • Debug and profile JavaScript
  • Quickly find errors
  • Explore the DOM
  • Execute JavaScript on the fly
  • Logging for JavaScript

对于WEB开发人员来说,可以非常方便的得到自己想要的信息:HTML、DOM、CSS、JS,甚至各个文件的下载时间。

刚测试了一下JS的调试功能,非常方便,可以设置断点,鼠标移至变量名上,可以得到相应值的提示。太棒了!

三、非Firefox浏览器的解决方案:Firebug Lite

对于非Firefox浏览器,Firebug也有相应的解决方案—Firebug Lite,通过使用console.log()输出错误信息至Firebug 控制台。

1.下载Firebug Lite

下载地址:http://getfirebug.com/releases/firebuglite1.0-b1.zip,解压至WEB目录,比如/js/firebug/。

在页面中增加以下代码:

  1. <script language="javascript" type="text/javascript"
  2. src="/path/to/firebug/firebug.js">script>

如果不想安装Firebug Lite,只是为了避免Javascript错误,可以点击这里下载firebugx.js然后copy至代码中即可。

这个文件的代码如下:

  1. if (!("console" in window) || !("firebug" in console))
  2. {
  3.     var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
  4.     "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
  5.     window.console = {};
  6. for (var i = 0; i < names.length; i)
  7.  window.console[names[i]] = function() {}
  8. }

2. Use Firebug Lite
By default, after opening the page, you can press F12 to open the Firebug console. If you don’t want to press F12 frequently to enter the debugging state, you can also press F12 on the HTML element to enter the debugging state. Add debug="true" as follows:

3. Use command line

Firebug also includes a command line program, you can use the following shortcut keys Ctrl Shift L (or ⌘ Shift L on Mac)

4. Test page
Press F12 or Ctrl Shift L to see the effect.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template