Đang chuẩn bị liên kết để tải về tài liệu:
Practical Web 2.0 Applications with PHP phần 9

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

ứng dụng có thể được sử dụng một cách đáng tin cậy của nhiều người. Trong chương này, tôi sẽ bao gồm một số các chi tiết này đề cập đến, chẳng hạn như xử lý các lỗi và thông báo cho người sử dụng phù hợp một điều gì đó đã đi sai, triển khai các ứng dụng trên một máy chủ sản xuất, sử dụng các bản ghi ứng dụng, và sao lưu ứng dụng. | Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com CHAPTER 12 IMPLEMENTING SITE SEARCH 459 var json transport.responseText.evalJSON true this.showSuggestions json showSuggestions function suggestions this.clearSuggestions if suggestions.size 0 return var ul Builder.node ul for var i 0 i suggestions.size i var li Builder.node li li.update suggestions i ul.appendChild li this.container.appendChild ul Another thing we do in the showSuggestions function is clear any existing terms before new ones are shown. We do this using clearSuggestions which is shown in Listing 12-37. This is called regardless of whether any search suggestions have been found if there are no suggestions there is nothing to show and if there are suggestions then we want to show only the new ones not ones that were previously there. Listing 12-37. Removing Existing Search Suggestions from the Search Container SearchSuggestor.class.js clearSuggestions function this.container.getElementsBySelector ul .each function e e.remove this.query null One more minor change we must now make is to the loadSuggestions function. Currently in this function if the search term is empty then we don t bother performing this Ajax request. We must now make it so in addition to not performing the Ajax request the current list of suggestions is hidden. The reason we add this is because if the user highlights the search input and presses Backspace the term would be deleted but the suggestions would remain. The code in Listing 12-38 fixes this issue. Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com 460 CHAPTER 12 IMPLEMENTING SITE SEARCH Listing 12-38. Clearing Suggestions When the Search Term Is Cleared SearchSuggestor.class.js loadsuggestions function var query F this.input .strip if query.length 0 this.clearSuggestions if query.length 0 query this.query return . other code Adding Mouse Navigation to Results Although the search suggestions are now being displayed when the user .

Đã 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.