TAILIEUCHUNG - ebook javascript&dtmhlp2

| CHAPTER 9 Managing Events Introduction Without events there would be no Dynamic HTML. A strong statement perhaps but given the kinds of document object models we have inherited it s true. For any dynamism to occur in an HTML page some kind of trigger is needed. Two categories of triggers are available user-generated actions and system-generated actions. Direct user-generated actions are those caused by mouse and keyboard activity. System-generated actions occur when something significant occurs in the browser such as the document completing its loading into the browser or an image failing to retrieve its data from the server. One of your jobs as a DHTML scripter is to determine which events on which elements or objects should trigger scripted actions. Any kind of form button for example will usually have some script action associated with it unless it is just the default actions of submit and reset input element types . Less obvious perhaps are events that inspect the characters being typed into a text box to make sure only allowed characters are permitted to pass. Very common mouse-oriented events detect when the cursor rolls atop an image element or an a hyperlink element surrounding the image so that a script can change the image to a highlighted version during this rollover. A corresponding event for when the cursor rolls off the image reverts the image back to its default version. Even the background processing of the XMLHttpRequest object fires events while it is in the process of receiving data from a server. The Event-Scripting Process In scripting terms you need a way to connect the occurrence of an event to some function that carries out tasks for that event. Events are said to be bound to an element or object. You instruct an element or object to be on the lookout for an event of a particular type that comes its way. For example you can instruct a button to respond to a mouse click on it while all surrounding elements ignore clicks on them. 231 .

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.