Firebug Script 调试记录
Your new friend, console.log //显示变量参数
console.log,
console.debug
,console.info
,console.warn
,console.error
...
console.log("helloworld")console.log(2,4,6,8,"foo",bar)
console.log("%a,%b","foo",bar)//"%"用于定义量
console.log("%sis%dyearsold.","Bob",42).
Timing and profiling // 时间及性能分析
console.profile();//性能开始console.time("test");//时间开始
functionTest()
{
for(vari=0;i<10;i++)
{
console.info("thisisatest");
}
}
Test();
console.timeEnd("test");//时间结束
console.profileEnd();//性能结束
Stack traces
console.trace()
Nested grouping
Just callconsole.group("a title")
to start a new indentation block, and thenconsole.groupEnd()
to close the block. You can create as many levels of indentation as you please.
Object inspection//显示对象信息
Callingconsole.dir(object)
will log an interactive listing of an object's properties, like a miniature version of the DOM tab.
Callingconsole.dirxml(element)
on any HTML or XML element will print a lovely XML outline, like a miniature version of the HTML tab.
console.dir(document.getElementById("sleCategory"));
console.dirxml(document.getElementById("sleCategory"));