TAILIEUCHUNG - Practical prototype and scipt.aculo.us part 18

Practical prototype and part 18: The information in this book is distributed on an "as is" basis, without warranty Although every pre-caution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. | CHAPTER 5 Events If you re a fan of the absurd bizarre and overcomplicated and you must be if you write JavaScript you re probably familiar with Rube Goldberg machines. Named for their cartoonist creator these ad hoc convoluted contraptions humorously obfuscate simple processes like flipping a light switch or opening a door. They paint a picture of a parallel universe where simple tasks are complicated. I m drawn to Goldberg machines because they re the opposite of how things work in everyday life. Usually we dream of an ideal world where things that seem simple actually are simple without reality stubbornly standing in the way. Browser-based event-driven interfaces should be simple. Highlight an element when the user clicks on it. Disable a submit button after a form has been submitted. But reality is harsh in the world of web development. Writing event handlers can feel like building an elaborate set of pulleys to open a window. In an unyielding quest to help client-side developers manage this complexity Prototype sports a robust event system one that makes simple things simple and complex things possible. State of the Browser Or How We Got Here I feel like a broken record browser wars lack of specifications Netscape did one thing Internet Explorer did another. It bears repeating because we re still feeling the effects 10 years later. Rather than subject you to a bland history lesson though I ll recap through code. Pre-DOM Part 1 Let s travel back in time to 1996 the heyday of Netscape the first version to implement JavaScript. Back in the day this was how you assigned events input type submit value Post onclick postBreakfastLogEntry 91 92 CHAPTER 5 EVENTS The event assignment was just another attribute in the HTML. On its face this is a simple and straightforward way to assign events it makes simple things simple. Unfortunately it also makes complex things damn near impossible. First note that we re inside a pair of quotation marks. What if we need to use .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
65    130    1    25-11-2024
54    140    1    25-11-2024
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.