<!--[if !vml]--> ![]() |
图
5-16
|
<!--[if !vml]--> ![]() |
图
5-17
|
<!--[if !vml]--> ![]() |
图
5-18
|
<!--[if !vml]--> ![]() |
图
5-19
|
<!--[if !vml]--> ![]() |
图
6-1
|
<!--[if !vml]--> ![]() |
图
7-1
|
|
<!--[if !vml]--> ![]() |
图
7-2
|
function test(){
for(var i=0;i<1000;i++){
document.getElementById('div2').innerHTML=i;
}
}
|
<div id="div2" onclick='test()'>
方块二</div>
|
for(var i=0;i<1000;i++){
”这行上设置一个断点,并设置条件为“
i=100
”(图
7-3
),然后单击“
div2
”开始执行函数
test
。
<!--[if !vml]--> ![]() |
图
7-3
|
<!--[if !vml]--> ![]() |
图
7-4
|
|
<!--[if !vml]--> ![]() |
图
7-5
|
<!--[if !vml]--> ![]() |
图
7-6
|
|
<!--[if !vml]--> ![]() |
图
7-7
|
<!--[if !vml]--> ![]() |
图
7-8
|
<!--[if !vml]--> ![]() |
图
9-1
|
|
<!--[if !vml]--> ![]() |
图
9-2
|
<!--[if !vml]--> ![]() |
图
9-3
|
<!--[if !vml]--> ![]() |
图
10-1
|
<!--[if !vml]--> ![]() |
图
10-2
|
<!--[if !vml]--> ![]() |
图
10-3
|
<!--[if !vml]--> ![]() |
图
10-4
|
<!--[if !vml]--> ![]() |
图
10-5
|
命令 |
说明 |
$(id)
|
通过
id
返回
Element
。
|
$$(selector)
|
通过
CSS
选择器返回
Element
数组。
|
$x(xpath)
|
通过
xpath
表达式返回
Element
数组。
|
dir(object)
|
列出对象的所有属性,和在
DOM
标签页查看该对象的是一样的。
|
dirxml(node)
|
列出节点的
HTML
或
XML
的源代码树,和在
HTML
标签页查看改节点一样。
|
cd(window)
|
默认情况下,命令行相关的是顶层
window
对象,使用该命令可切换到
frame
里的
window
独享。
|
clear()
|
清空信息显示区,和单击按钮
Clear
功能一样。
|
inspect(object[, tabName])
|
监视一个对象。
tabName
表示在那个标签页对该对象进行监视,可选值为“
html
”、“
css
”、“
script
”和“
dom
”。
|
keys(object)
|
返回由对象的属性名组成的数组。
|
values(object)
|
返回由对象的属性值组成的数组。
|
debug(fn)
|
在函数的第一行增加一个断点。
|
undebug(fn)
|
移除在函数第一行的断点。
|
monitor(fn)
|
跟踪函数
fn
的调用。
|
unmonitor(fn)
|
不跟踪函数
fn
的调用。
|
monitorEvents(object[, types])
|
跟踪对象的事件。
Types
的可选值为“
composition
”、
“
contextmenu
”、
“
drag
”、
“
focus
”
,
、“
form
”、“
key
”、
“
load
”、“
mouse
”、“
mutation
”、“
paint
”、“
scroll
”、“
text
”、“
ui
”和“
xul
”。
|
unmonitorEvents(object[, types])
|
不跟踪对象的事件。
Types
的可选值为“
composition
”、
“
contextmenu
”、
“
drag
”、
“
focus
”
,
、“
form
”、“
key
”、
“
load
”、“
mouse
”、“
mutation
”、“
paint
”、“
scroll
”、“
text
”、“
ui
”和“
xul
”。
|
profile([title])
|
开始对脚本进行性能测试,可选参数
title
将作为测试结果的标题。
|
profileEnd()
|
结束脚本性能测试。
|
表
3
|
console.log('Hello');
|
console.log('
当前的参数是:
%d',i);
|
<!--[if !vml]--> ![]() |
图
11-1
|
console.log(2,4,window,test,document);
|
<!--[if !vml]--> ![]() |
图
11-2
|
<!--[if !vml]--> ![]() |
图
11-3
|
console.debug('This is console.debug!');
console.info('This is console.info!');
console.warn('This is console.warn!');
console.error('This is console.error!');
|
<!--[if !vml]--> ![]() |
图
11-4
|
console.group('
开始分组:
');
console.debug('This is console.debug!');
console.info('This is console.info!');
console.warn('This is console.warn!');
console.error('This is console.error!');
console.groupEnd();
|
开始分组:
”。如果需要,我们还可以通过嵌套的方式,在组内再分组。
<!--[if !vml]--> ![]() |
图
11-5
|
console.dir(document.getElementById('div1'));
console.dirxml(document.getElementById('div1'));
|
<!--[if !vml]--> ![]() |
图
11-6
|
<!--[if !vml]--> ![]() |
图
11-7
|