Javascript 使用IDE工具进行调试
1. Javascript Debug Toolkit介绍
JSDT(Javascript Debug Toolkit)是一个用于javascript调试的eclipse
插件,用于调试javascript。JSDT可以跨浏览器调试,支持在IE,Firefox,Safari,Chrome等主流浏览器中调试
javascript。JSDT支持设置断点,单步调试等调试工具的基本特性。
2. 如何安装
JSDT是基于eclipse3.2+,jdk1.5+基础开发的,因此安装JSDT前应当先安装jdk1.5+和eclipse3.2+。
JSDT下载地址:http://code.google.com/p/jsdt/downloads/list
,其中jsdt-1.0.0.zip是JSDT的安装包,下载把其中的三个jar包解压到eclipse的plugins目录下,重启eclipse即可。
jsdt-simple.swf是一段使用jsdt在chrome浏览器调试javascript的简单例子的录象。
jsdt-ext-desktop.swf是一段使用jsdt在safari浏览器调试javascript的录象。
3.如何使用
1. 在eclipse中打开调试对话框,如下图所示:
2. 新建一个Javascript Debug,如下图所示
在url中输入要调试的url--本地文件名或服务器上的文件名(只支持http类型的url)。在browser输入框中选择浏览器(ie,firefox,safari或chrome等)
点击调试后会打开浏览器,,eclipse也会转到调试视图,并打开所有用到的javascript文件。
如果没有打开javascript文件,请查看调试透视图中是否打开了Debug Scripts视图
如果没有打开该视图,请点击:window-show view-other->Debug Scripts打开Debug
Scripts视图,再选择当前调试堆栈,即可看到Debug Scripts视图,双击Debug
Scripts中的文件,即可打开script文件。
3. 设置断点
在js文件中可以设置断点
浏览器中运行到该行js时会自动中断,eclipse也会停止在该断点,等待用户操作。
4. 其他操作
因为其他操作和eclipse调试是一样的,这里不再多讲。
相关文档:
Yielding with Timers 用定时器让出时间片
Despite your best efforts, there will be times when a JavaScript task cannot be completed in 100 milliseconds or less because of its complexity. In these cases, it's ideal to yield control of the UI thread so that UI updates may occur ......
第八章 Programming Practices 编程实践
Every programming language has pain points and inefficient patterns that develop over time. The appearance of these traits occurs as people migrate to the language and start pushing its boundaries. Since 2005, when the term "Ajax" ......
Working Around Caching Issues 关于缓存问题
Adequate cache control can really enhance the user experience, but it has a downside: when revving up your application, you want to make sure your users get the latest version of the static content. This is accomplished by renaming ......
Firebug
Firefox is a popular browser with developers, partially due to the Firebug addon (available at http://www.getfirebug.com/), which was developed initially by Joe Hewitt and is now maintained by the Mozilla Foundation. This tool has increased the productivity of web develop ......