<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 12, comments - 4, trackbacks - 0, articles - 0

    FireBug 控制臺(tái)函數(shù)說(shuō)明               

    原文地址:http://www.joehewitt.com/software/firebug/docs.php
    http://www.nirvanastudio.org/javascript/firebug-%E6%8E%A7%E5%88%B6%E5%8F%B0%E5%87%BD%E6%95%B0%E8%AF%B4%E6%98%8E.html

    FireBug 是一個(gè)非常實(shí)用的JavaScript以及DOM查看調(diào)試工具,是 Firefox 的一個(gè)插件。使用 FireBug 調(diào)試 AJAX 應(yīng)用非常方便,終于可以告別 alert 時(shí)代了!

    Console Logging 函數(shù)FireBug 為所有 Web 頁(yè)面提供了一個(gè) console 對(duì)象。這個(gè)對(duì)象有以下函數(shù):
    Logging 基礎(chǔ)
    console.log("message" [,objects]) - 將一個(gè)字符串打印到控制臺(tái)。字符串可以包含任何“String Formatting”小節(jié)描述的模式。字符串后面的對(duì)象應(yīng)該用來(lái)取代之前字符串中的模式。(譯者注:大家用過(guò)C里面 printf 吧,效果基本是一樣的。)
    Logging 等級(jí)通常根據(jù)不同的等級(jí)來(lái)區(qū)分Logging的嚴(yán)重程度是很有幫助的。FireBug 提供了4個(gè)等級(jí)。為了達(dá)到視覺(jué)分離的效果,這些函數(shù)與 log 不同的地方就是它們?cè)诒徽{(diào)用的時(shí)候會(huì)自動(dòng)包含一個(gè)指向代碼行數(shù)的鏈接。
    console.debug("message" [,objects]) - 記錄一個(gè) debug 消息。
    console.info("message" [,objects]) - 記錄一個(gè)信息.
    console.warn("message" [,objects]) - 記錄一個(gè)警告.
    console.error("message" [,objects]) - 記錄一個(gè)錯(cuò)誤.
    斷言斷言是一條確保代碼規(guī)則的非常好的途徑。console 對(duì)象包含了一系列各種類(lèi)型的斷言函數(shù),并且允許你編寫(xiě)自己的斷言函數(shù)。
    console.assert(a, "message" [,objects]) - Asserts that an a is true.
    console.assertEquals(a, b, "message" [,objects]) - Asserts that a is equal to b.
    console.assertNotEquals(a, b, "message" [,objects]) - Asserts that a is not equal to b.
    console.assertGreater(a, b, "message" [,objects]) - Asserts that a is greater than b.
    console.assertNotGreater(a, b, "message" [,objects]) - Asserts that a is not greater than b.
    console.assertLess(a, b, "message" [,objects]) - Asserts that a is less than b.
    console.assertNotLess(a, b, "message" [,objects]) - Asserts that a is not less than b.
    console.assertContains(a, b, "message" [,objects]) - Asserts that a is in the array b.
    console.assertNotContains(a, b, "message" [,objects]) - Asserts that a is not in the array b.
    console.assertTrue(a, "message" [,objects]) - Asserts that a is equal to true.
    console.assertFalse(a, "message" [,objects]) - Asserts that a is equal to false.
    console.assertNull(a, "message" [,objects]) - Asserts that a is equal to null.
    console.assertNotNull(a, "message" [,objects]) - Asserts that a is not equal to null.
    console.assertUndefined(a, "message" [,objects]) - Asserts that a is equal to undefined.
    console.assertNotUndefined(a, "message" [,objects]) - Asserts that a is not equal to undefined.
    console.assertInstanceOf(a, b, "message" [,objects]) - Asserts that a is an instance of type b.
    console.assertNotInstanceOf(a, b, "message" [,objects]) - Asserts that a is not an instance of type b.
    console.assertTypeOf(a, b, "message" [,objects]) - Asserts that the type of a is equal to the string b.
    console.assertNotTypeOf(a, b, "message" [,objects]) - Asserts that the type of a is not equal to the string b.
    測(cè)量(Measurement)下面的一些函數(shù)可以讓你方便的測(cè)量你的一些代碼。
    console.trace() - 記錄執(zhí)行點(diǎn)的堆棧信息。
    console.time("name") - 根據(jù) name 創(chuàng)建一個(gè)唯一的計(jì)時(shí)器。
    console.timeEnd("name") - 根據(jù) name 停止計(jì)時(shí)器,并且記錄消耗的時(shí)間,以毫秒為單位。
    console.count("name") - 記錄該行代碼執(zhí)行的次數(shù)。
    字符串格式化所有 console 的 logging 函數(shù)都可以通過(guò)以下模式格式化字符串:
    %s - 將對(duì)象格式化為字符串。
    %d, %i, %l, %f - 將對(duì)象格式化為數(shù)字。
    %o - 將對(duì)象格式化成一個(gè)指向 inspector 的超鏈接。
    %1.o, %2.0, etc.. - 將對(duì)象格式化成包含自己屬性的可交互的表格。
    %.o - 將對(duì)象格式化成具有自身屬性的一個(gè)數(shù)組。
    %x - 將對(duì)象格式化成一個(gè)可交互的 XML 樹(shù)形結(jié)構(gòu)。
    %1.x, %2.x, etc.. - 將對(duì)象格式化成一個(gè)可交互的 XML 數(shù)型結(jié)構(gòu),并且展開(kāi) n 層節(jié)點(diǎn)。
    如果你需要一個(gè)真實(shí)的 % 符號(hào),你可以通過(guò)一個(gè)轉(zhuǎn)移符號(hào)就像這樣 "\%"。
    命令行函數(shù)內(nèi)建的命令行函數(shù)可以通過(guò)以下命令行使用:
    $("id") - document.getElementById() 的簡(jiǎn)寫(xiě)。(譯者注:跟 prototype.js 學(xué)來(lái)的吧?)
    $$("css") - 返回一個(gè)符合 CSS 選擇器的元素?cái)?shù)組。
    $x("xpath") - 返回一個(gè)符合 XPath 選擇器的元素?cái)?shù)組。
    $0 - 返回最近被檢查(inspected)的對(duì)象。
    $1 - 返回最近被檢查(inspected)的下一個(gè)對(duì)象。
    $n(5) - 返回最近被檢查的第n個(gè)對(duì)象。
    inspect(object) - 將對(duì)象顯示在 Inspector 中。
    dir(object) - 返回一個(gè)對(duì)象的屬性名數(shù)組。(譯者注:跟 Python 學(xué)的?)
    clear() - 清除控制臺(tái)信息。

    主站蜘蛛池模板: 亚洲熟妇AV一区二区三区宅男| 亚洲日韩av无码| 亚洲va成无码人在线观看| 91青青国产在线观看免费| 亚洲视频一区网站| 亚洲精品视频免费在线观看| 日韩精品一区二区亚洲AV观看| 精品福利一区二区三区免费视频| 亚洲福利视频网址| 一色屋成人免费精品网站| 亚洲日产乱码一二三区别| 可以免费观看一级毛片黄a| 一区二区3区免费视频| 亚洲精品无码久久久久sm| 无码人妻精品中文字幕免费| 亚洲黄色免费网址| 毛片免费观看网站| 一区二区免费国产在线观看 | a级毛片免费观看在线| 亚洲国产精品无码AAA片| 蜜臀AV免费一区二区三区| 亚洲色大成网站www| 国产a v无码专区亚洲av| 久久国产免费观看精品| 狠狠色香婷婷久久亚洲精品| 国产亚洲福利一区二区免费看| 国产精品免费久久| 亚洲国产一区在线观看| 免费少妇a级毛片人成网| 一级毛片免费观看| 国产亚洲综合精品一区二区三区| 国产精品亚洲一区二区三区在线 | 亚洲av无码专区首页| 久久久青草青青国产亚洲免观 | 最近最新高清免费中文字幕| 亚洲人成网站999久久久综合| 精品国产亚洲男女在线线电影| 2021国内精品久久久久精免费| 亚洲欧美成人一区二区三区| 亚洲精品白浆高清久久久久久| 免费毛片a在线观看67194|