TAILIEUCHUNG - Developing Large Web Applications- P12

Developing Large Web Applications- P12:This book presents a number of techniques for applying established practices of good software engineering to web development—that is, development primarily using the disparate technologies of HTML, CSS, JavaScript, and server-side scripting languages. Whereas there are many books on how to use languages, how to use libraries, and how to approach software engineering, this is the first book to codify many of the techniques it presents. These techniques will make the components of your own web applications more reusable, maintainable, and reliable | The use of objects also gives you a way to group prototype objects into libraries. You can see examples of this in the YUI library which we ll present later. When you call for example you re calling a method that is actually a member of the Dom object which is a member of the util object which in turn is a member of the YAHOO object. At the end of this chapter we ll explore a prototype object called MultiSelect that we ve placed in the MVC namespace. Whenever you do this you need to check whether the namespace object already exists so that if it doesn t exist you can create it as shown here Place the component within the MVC namespace create it if needed. if MVC . function text url id name prev . Accessing a module by ID Once you have an object that encapsulates the data and methods for a module that object typically spends most of its time working in just the part of the DOM that contains the elements for that module. Therefore it s useful in the constructor for the module object to set data members to whatever parts of the DOM you ll need access to rather than retrieving them over and over again within various parts of the object. This improves performance and acts somewhat as a means of binding a JavaScript object to the HTML elements for which the object is adding a behavior layer. One of the most important DOM methods for this is . This method returns a reference to the element with the ID you specify. As we saw in Chapter 4 a good way to scope a module for CSS and JavaScript too is to give its outermost div an id attribute. Once you have a reference to this div you can target all other DOM operations within the proper scope for the module. Thus Example 5-2 illustrates accessing the DOM for a PictureSlider instance in the constructor for the object. The example also uses other DOM methods to get various elements within the module which we ll explore further in the next section. Example .

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.