TAILIEUCHUNG - Pro JavaScript Techniques phần 4

Điều này có lẽ là chương quan trọng nhất trong cuốn sách này nếu được thực hiện với trái tim, vì nó sẽ hoàn toàn thay đổi cách bạn nhìn vào JavaScript là một ngôn ngữ.: Click sự kiện: Một di chuyển thông minh trên một phần của | 94 CHAPTER 5 THE DOCUMENT OBJECT MODEL Tip Dean Edwards is a JavaScript wizard his code is absolutely amazing. I highly recommend poking around in his cssQuery library at the very least to see how great extensible JavaScript code is written. jQuery This is a recent entrant into the world of JavaScript libraries but provides some significantly new ways of writing JavaScript code. I first wrote it to be a simple CSS selector library much like cssQuery until Dean Edwards released his excellent cssQuery library forcing this code in a different direction. The library provides full CSS 1-3 support along with some basic XPath functionality. On top of this it additionally provides the ability to do further DOM navigation and manipulation. Like cssQuery jQuery has complete support for modern web browsers. Here are some examples of how to select elements using jQuery s custom blend of CSS and XPath Find all div s that have a class of links and a p element inside of them p Find all descendants of all p s and div s p div .find Find every other link that points to Google a @hrefA even Now to use the results from jQuery you have two options. First you can do expression .get to get an array of matched elements the same exact result as cssQuery. The second thing that you can do is use jQuery s special built-in functions for manipulating CSS and the DOM. So going back to the example with cssQuery of adding a border to all Google links you could do the following Add a border around all links to Google a @hrefA .css border 1px dashed red A lot of examples demos and documentation can be found on the jQuery project site in addition to a customizable download http . Note It should be stated that neither cssQuery nor jQuery actually require the use of an HTML document for navigation they may be used on any XML document. For a pure XML form of navigation read the next section on XPath. CHAPTER 5 THE DOCUMENT OBJECT MODEL 95 XPath XPath .

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.