build your own ajax web applications PHẦN 8

Để có được xung quanh hành vi này, chúng tôi kiểm tra các yếu tố trong cùng để xem nếu nó có một thuộc tính id. Nếu không, chúng ta kiểm tra xem cha mẹ của nó, và nếu cha mẹ của nó không, chúng tôi kiểm tra xem cha mẹ của nó, và như vậy. | The init Method var enable false new Ajax searchForm resultsDiv . block function return false searchButton The init method starts off by doing all your normal app initialization stuff it creates the Ajax object for submitting searches and sets up a reference to the web form. Next it turns on the results section of the UI. A CSS declaration of display none is associated with the div that has the ID resultsDiv as such non-JavaScript browsers won t see the div but browsers that do support JavaScript will. This is the div that will contain our AJAX-powered UI. As part of this application we ll be looking at how we could build an alternate UI for non-JavaScript browsers that will POST to a different page. Next init sets up an event handler for the form s Submit button. We re using an input type submit element for this button which allows the form to work for non-JavaScript-capable clients too. We don t want our JavaScript clients to submit the actual form because we re making our requests with AJAX thus we have to suppress form submission. Then the method places a reference to what will become the Submit button s onclick event handler into the hand property an associative array with the button ID as key. Then the method places into the hand property an associative array with the button ID as its key The method places into hand a reference to the method that will become the Submit button s onclick event handler. This gives us a convenient way to store all the onclick handlers for the buttons so we can turn buttons on and off at will. We ll see how this works in the next section. Next is a call to evalSearchTextState which looks at the SearchText field and either enables or disables the Search button based on whether or not it contains any text. Here s the code for evalSearchTextState 203 Licensed to siowchen@ .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
18    86    1    03-06-2024
Đã 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.