chrome开发者工具中console的用途
来源:互联网 发布:淘宝美工修图视频 编辑:程序博客网 时间:2024/05/16 08:52
chrome开发者工具中Console可以再任何面板中显示出来。可以点击下面的按钮,也可以按ESC键。
Console的用途很多,不像其他面板只有一种用途。
Console中可以使用firebug的命令行API。
常用的命令:
(1)$("id")显示特定id的元素;
(2)$0,返回上一个审查(Inspect)的元素。
(3)$1,返回倒数第二个审查的元素。
(4)dir(object),显示DOM对象的属性,将DOM看做javascript对象。
(5)dirxml(node),以html形式显示节点,和elements面板中看到的一样。
chrome的介绍中没有找到完整的API介绍。可以参考firebug的。
help
Returns a list of Command Line API commands including short descriptions.
$(id)
Returns a single element with the given id.
Warning: it will ultimately change to return the first match for the given CSS selector.
$$(selector)
Returns an array of elements that match the given CSS selector.
$x(xpath)
Returns an array of elements that match the given XPath expression.
$0
Represents the last element selected via the Inspector.
$1
Represents the second last element selected via theInspector.
$n(index)
Returns one of the 5 last elements selected via theInspector. This method takes one required parameterindex
, which represents the index of the element (starting at 0).
dir(object)
Prints an interactive listing of all properties of the object. This looks identical to the view that inside theDOM Panel.
dirxml(node)
Prints the XML source tree of an HTML or XML element. This looks identical to the view inside theHTML Panel. You can click on any node to inspect it in the HTML panel.
cd(window)
By default, command line expressions are relative to the top-level window of the page. cd() allows you to use the window of a frame in the page instead.
clear()
Clears the console.
copy(object)
Copies the given parameter to the clipboard. This can be a return value of a function or an object.
inspect(object[, panelName])
Inspects an object in the most suitable panel, or the panel identified by the optional argumentpanelName
.
The available tab names are "html", "stylesheet", "script", and "dom".
keys(object)
Returns an array containing the names of all properties of the object.
values(object)
Returns an array containing the values of all properties of the object.
include(url[, alias]) / include(alias)
Includes a remote script.
debug(fn)
Adds a breakpoint on the first line of a function.
undebug(fn)
Removes the breakpoint on the first line of a function.
monitor(fn)
Turns on logging for all calls to a function.
unmonitor(fn)
Turns off logging for all calls to a function.
monitorEvents(object[, types])
Turns on logging for all events dispatched to an object. The optional argumenttypes
may define specific events or event types to log.
unmonitorEvents(object[, types])
Turns off logging for all events dispatched to an object. The optional argumenttypes
may define specific events or event families, for which to turn logging off.
For a list of available event families see monitorEvents(object[, types]).
profile([title])
Turns on the JavaScript profiler. The optional argumenttitle
contains the text to be printed in the header of the profile report.
profileEnd()
Turns off the JavaScript profiler and prints its report.
table(data[, columns])
This is a shortcut for console.table()
.
traceCalls(fn)
Enables tracing of specific function calls.
untraceCalls(fn)
Disables tracing of specific function calls.
traceAll()
Enables tracing of function calls for a whole context.
untraceAll()
Disables tracing of function calls for a whole context.
详细地址:https://getfirebug.com:80/wiki/index.php/Command_Line_API
- chrome开发者工具中console的用途
- chrome开发者工具console
- Chrome开发者工具详解(1)-Elements、Console、Sources面板 Chrome开发者工具面板
- Chrome开发者工具之:Elements、Console、Sources面板
- Chrome开发者工具详解(1)-Elements、Console、Sources面板
- chrome中强大的console
- Chrome的开发者工具详解
- Chrome开发者工具的使用
- chrome开发者工具的使用
- ie的开发者工具(Console Debugging API )
- chrome开发者工具(DevTools)中快捷方式列表
- chrome中console的那些用法!
- 怎样打开Chrome的开发者工具?
- chrome浏览器开发者工具的使用
- Chrome开发者工具的小技巧
- CHROME开发者工具的小技巧
- CHROME开发者工具的小技巧
- chrome开发者工具的小技巧
- ubuntu下motion安装调试的补充
- sublime 2 下载地址
- C++ new操作符详解
- Java使用starling分布式消息队列异步处理事务
- 深入浅出K-means算法
- chrome开发者工具中console的用途
- tableview中cell的设置
- 用VB来封装DLL加密ASP文件
- 身份证15位转18位
- copy绝版应用【转】
- Hadoop的TaskTracker黑名单机制
- 快速排序(递归,非递归),希尔排序,冒泡排序的比较
- Centos安装oracle10g
- android 网络编程 HttpGet类和HttpPost类使用详解