TAILIEUCHUNG - JavaScript Bible, Gold Edition part 169

JavaScript Bible, Gold Edition part 169. 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-172 Part VI Appendixes Listing 15-19b continued INPUT TYPE button VALUE Switch On Behavior onClick turnOn Choose a hot color SELECT NAME colorChoice onChange setColor this OPTION VALUE red red OPTION VALUE blue blue OPTION VALUE cyan cyan SELECT BR INPUT TYPE button VALUE Switch Off Behavior onClick turnOff P INPUT TYPE button VALUE Count the URNs onClick showBehaviorCount P BODY HTML To turn off the behavior the removeBehavior method is invoked. Notice that the removeBehavior method is associated with the myP object and the parameter is the ID of the behavior added earlier. If you associate multiple behaviors with an object you can remove one without disturbing the others because each has its own unique ID. addEventListener eventType listenerFunc useCapture removeEventListener eventType listenerFunc useCapture NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 Compatibility Example Listing 15-20 provides a compact workbench to explore and experiment with the basic W3C DOM event model. When the page loads no event listeners are registered with the browser except for the control buttons of course . But you can add an event listener for a click event in bubble and or capture mode to the BODY element or the P element that surrounds the SPAN holding the line of text. If you add an event listener and click the text you see a readout of the element processing the event and information indicating whether the event phase is bubbling 3 or capture 1 . With all event listeners engaged notice the sequence of events being processed. Remove listeners one at a time to see the effect on event processing. e ementOb Appendix F Examples from Parts III and IV CD-173 Listing 15-20 includes code for event capture that does not operate in NN6. Event capture facilities should work in a future version of the browser. Listing 15-20 W3C Event Lab HTML HEAD TITLE W3C Event Model Lab TITLE STYLE TYPE text css TD text-align center STYLE SCRIPT LANGUAGE JavaScript add

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