firebug的应用

firebug再前端调试中起到了非常好的作用能看到DOM的性能,以及检測。比方运用console.log()就是要比alert();好一些这样增强的页面的连续性而且console.warn()和console.error也在浏览器中的控制台中报错或者弹出警告,这样也是非常实用的。假设运用多个log是不easy看清的,这样就能够这样分组 //console.group("this is one");
    //console.log(1);
    //console.groupEnd();这样分组的优点就是能看出须要调试的是哪一代码;有的时候console.log不能全然显示这样就能吧log换位dir这样就能全然显示

尽管这个在谷歌和火狐上是实用的,可是在IE上也是能够的仅仅须要在有网的情况下增加<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>这一样代码,在在IE也就能够用了

也能够先把资源下载下来https://getfirebug.com/firebuglite然后在文件中引用就能够了




<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题</title>
    <script type="text/javascript">
    ///////////////////////
    //console.log(1285); //
    ///////////////////////
    //console.warn("this is a warn ");
    //console.group("this is one");
    //console.log(1);
    //console.groupEnd();

    //console.group("this is two");  //代表分组
    //console.log(2);
    //console.groupEnd();//分组结束
    //var cat={};
    //cat.color="red";
    //cat.name1="shang";
    //cat.name2="shang";
    //cat.name3="shang";
    //cat.name4="shang";
    //cat.name5="shang";
    //cat.show=function(){
    //    return "cat";
    //}
    //console.log(cat);
    //console.dir(cat);//这个相比于前面是所有显示
    //var odiv1=document.getElementById('div1');
    //console.dirxml(odiv1); // 显示当前元素的结构代码
    //console.log(58);
    
    //var a=0;
    //console.assert(a);


    //function a(){
    //    return b();
    //}
    //function b(){
    //    return c();
    //}
    //function c(){
    //    console.trace();
    //    return 132;
    //}
//a();
    
    //console.time("时间");//这里要写一个标题也就是双引號里面的东西
    //for(var i=0;i<1000000000;i++){}
    //console.timeEnd("时间");//前后都须要有标题
//并且同样    //

    </script>
</head>
<body>
<div id="div1">
    <span>16746</span>>
</div>
</body>
</html>
原文地址:https://www.cnblogs.com/yutingliuyl/p/7160753.html