TAILIEUCHUNG - Beginning JavaScript Third Edition phần 6

Phương pháp thứ hai bạn sẽ sử dụng để mở các trình gỡ lỗi bắt đầu bằng cách tải các trang web mà bạn muốn gỡ lỗi vào trình duyệt của bạn, sau đó bạn sử dụng Break Tiếp theo tùy chọn trình đơn Bản Tuyên Bố dưới Debugger Script trên menu Internet Explorer Xem này, như trong hình 10-12. | Chapter 10 Common Mistakes Debugging and Error Handling Figure 10-10 Having corrected the mistake and reloaded the page you should see the two times table in your web page as shown in Figure 10-11. Figure 10-11 The second method you re going to use to open the debugger begins with loading the page you want to debug into your browser then you use the Break at Next Statement menu option under Script Debugger on the Internet Explorer View menu as shown in Figure 10-12. 372 Chapter 10 Common Mistakes Debugging and Error Handling Figure 10-12 You ve already got loaded so select View o Script Debugger o Break at Next Statement. Not much appears to happen but reload the page by clicking the refresh icon or pressing F5 and the debugger will open at the next JavaScript statement executed. Where the next JavaScript statement occurs in your page depends on your code. If you have code in the page other than a function or code connected to an event handler the first line the browser executes will be the next JavaScript statement. In your case this is the code calling the following function script writeTimesTable 2 script If there is no code in the page except code inside event handlers or functions the next statement executed will be that fired in an event handler such as the window object s onload event handler or a button s onclick event handler. Note that with some setups of the script debugger the browser brings up a dialog box saying that an exception of type Runtime Error was not handled. This does not mean that there is an error in the code but is simply the way Break at Next Statement works. As you can see from Figure 10-13 the next statement executed in your example occurs when the browser reaches the script embedded in your web page that calls the writeTimesTable function. Again this script is highlighted in yellow by the debugger. 373 Chapter 10 Common Mistakes Debugging and Error Handling Figure 10-13 You re now going to use the Step Into icon .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.