如何使用firefox适用于javascript的debugger命令

来源:互联网 发布:python 有序字典 编辑:程序博客网 时间:2024/06/01 20:42

首先安装firebug,在firefox的扩展里搜索安装即可。
然后在页面中启用firebug中的脚本:

启用firebug的脚本调试

然后在网页某些位置加入debugger命令,比如如下页面代码:

<!DOCTYPE html><html><head><meta charset="utf-8" /><title>js弹出新窗口</title><script type="text/javascript">    function open_new(obj){        debugger;        window.open(obj.href,'search','width=400,height=300,left=500,top=500,scrollbars,resizable');    }</script></head><body>    <a href="http://www.baidu.com" onclick="open_new(this);return false;">    go to baidu to search!</a></body></html>

在鼠标单击链接时,会执行open_new()函数,而该函数中含有debugger命令,所以会在这个地方中断下来。你可以停下来查看一些变量的值,或选择继续执行。

0 0