TAILIEUCHUNG - JavaScript Bible, Gold Edition part 11

JavaScript Bible, Gold Edition part 11. This book will bring programmers and non-technical professionals, including casual programmers and scripters, painlessly up to speed on all aspects of mastering JavaScript. Key topics include programming fundamentals, JavaScript language elements and how to use them effectively, and how to easily and efficiently add powerful new functionality to HTML documents and Java applets. | CD-30 Part II JavaScript Tutorial Listing 5-8 Running a Script from User Action HTML HEAD TITLE An onClick script TITLE SCRIPT LANGUAGE JavaScript -- function alertUser alert Ouch -- SCRIPT HEAD BODY Here is some body text. FORM INPUT TYPE text NAME entry INPUT TYPE button NAME oneButton VALUE Press Me onClick alertUser FORM BODY HTML Not every object must have an event handler defined for it in the HTML as shown in Listing 5-8 only the ones for which scripting is needed. No script statements execute in Listing 5-8 until the user clicks the button. The alertUser function is defined as the page loads and it waits to run as long as the page remains loaded in the browser. If it is never called upon to run there s no harm done. The last scenario for when script statements run also involves functions. In this case a function is called upon to run by another script statement. Before you see how that works it helps to read through the next lesson Chapter 6 . Therefore I will hold off on this example until later in the tutorial. Viewing Script Errors In the early days of JavaScript in browsers script errors displayed themselves in very obvious dialog boxes. These boxes were certainly helpful for scripters who wanted to debug their scripts. However if a bug got through to a page served up to a non-technical user the error alert dialog boxes were not only disruptive but also scary. To prevent such dialog boxes from disturbing unsuspecting users the browser makers tried to diminish the visual impact of errors in the browser window. Unfortunately for scripters it is often easy to overlook the fact that your script contains an error because the error is not so obvious. Recent versions of IE and NN have different ways of letting scripters see the errors. In IE5 you can set its preferences so that scripts do not generate error dialog boxes got to Tools Internet Options Advanced Browsing and find the checkbox entry that says Display a notification about every script error . Even .

TỪ KHÓA LIÊN QUAN
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.