Có, di chuyển chuột xung quanh, và thực hiện vô số người sử dụng các yếu tố clickInpage khác, vào thứ xảy ra, cả trong cuộc sống và trong các ứng dụng web. dữ liệu, hoạt động. chính thức hơn Stuff xảy ra . Chỉ cần Xử lý CNTT-Unknown | 14 Events and Event Handling Stuff Happens. Just Handle It Unknown Yes stuff happens both in life and in web applications. Users click page elements enter data move the mouse around and perform myriad other activities. In a more formal way we refer to the stuff that happens as events. And our response to events can t be passive. Our pages must do things to handle the events. Events and event handling and how Dojo can help are the topics of this chapter. Description of the Event Model In this chapter we examine events and event handling in Dojo. But as we delve into the Dojo specifics it is also important to review the techniques for identifying and responding to events in the standard browser programming model and JavaScript. That way Dojo extensions will make more sense. To summarize we ll discuss the main topics related to events and describe the techniques first in plain JavaScript and then using Dojo. I ll cover the following topics What are events What are event handlers and how are they assigned How are events represented 250 Chapter 14 Events and Event Handling What Are Events The common meaning of events is stuff that happens. And this definition can be applied to the browser programming model as well. There are two primary categories of events things that happen to the DOM and things that happen outside the first category of events is known as DOM events. The second category of events is Browser events. DOM events include things done to the DOM as a whole or to individual DOM classic DOM event occurs when a user clicks a DOM element such as a button or a link. But there are many other possible events. The browser can detect various types of user interaction coming from the keyboard or the mouse. And the user may interact with any of the DOM elements on the page even those that don t appear to allow user response such as paragraph text or image files. For example when a user moves the mouse over some paragraph text a number