Tham khảo tài liệu 'beginning ajax with php from novice to professional phần 10', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 206 CHAPTER 13 TESTING AND DEBUGGING Figure 13-1. The Internet Explorer JavaScript debugger After several years of Internet Explorer frustration I was pleased to learn that Firefox provides a rather effective JavaScript debugging console. When a JavaScript error occurs in Firefox precise details of the error are logged into its internal JavaScript console. The user can then access this console to see a list of all errors that have occurred in a script s execution. While Internet Explorer enjoys giving you nondescript error messages the JavaScript console in Firefox see Figure 13-2 provides a detailed description of the type of error that occurred error warning or message the details of the error involved and even the file location it occurred at along with a line number. While Firefox offers superior JavaScript debugging reporting to Internet Explorer Internet Explorer testing remains a necessary task as there are some differing standards in use between the two browsers. As Ajax has the potential to be totally cross-platform it can help to have a version of all the major browsers at your disposal when testing your applications. Remember that just because something works great in one browser it doesn t mean that it will work perfectly in all browsers. It is important to know who your core audience is and to ensure that you have code that will work to the advantage of as many of your users as possible ideally all of them . When you first open the console click Tools JavaScript Console you will notice a few buttons at the top an area to enter code and a listing of any errors that have occurred. The buttons at the top mainly provide a means of sorting error messages by type and are pretty self-explanatory. Consider setting the default error reporting level to All meaning that all logged messages are displayed . CHAPTER 13 TESTING AND DEBUGGING 207 Figure 13-2. Firefox s JavaScript console The error message box will catch everything from CSS issues to JavaScript .