firebug的應用,firebug應用
firebug再前端調試中起到了很好的作用能看到DOM的效能,以及檢測,比如運用console.log()就是要比alert();好一些這樣增強頁面的連續性並且console.warn()和console.error也在瀏覽器中的控制台中報錯或者彈出警告,這樣也是很有用的,如果運用多個log是不容易看清的,這樣就可以這樣分組 //console.group("this is one");
//console.log(1);
//console.groupEnd();這樣分組的好處就是能看出需要調試的是哪一代碼;有的時候console.log不能完全顯示這樣就能吧log換位dir這樣就能完全顯示
雖然這個在Google和Firefox上是有用的,但是在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>
著作權聲明:本文為博主原創文章,未經博主允許不得轉載。