TAILIEUCHUNG - Xây dựng ứng dụng cho Android với HTML, CSS và javascript - part 10

Tham khảo tài liệu 'xây dựng ứng dụng cho android với html, css và javascript - part 10', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | link type text css rel stylesheet media screen href themes jqt script type text javascript src jqtouch script script type text javascript src jqtouch script script type text javascript src script head Alert readers will notice that I ve also removed the jQTouch constructor from the head of the HTML document. It s not gone though I just moved it into . Be sure you remove that from your main HTML file and create the file in the same directory with the following contents then reload the main HTML document in your browser to make sure it s still working var jQT .jQTouch icon With that little bit of code reorganization out of the way it s time to add the code needed to save the settings. You need to override the submit action of the Settings form and replace it with a custom function called saveSettings . Thanks to jQuery you can accomplish this with a single line of code which you must place in the document ready function. Add the following to document .ready function settings form .submit saveSettings The net result of this is that when the user submits the settings form the saveSet tings function will run instead of the form actually getting submitted. When the saveSettings function is called it grabs the values from the three form inputs using jQuery s val function and saves each in a localStorage variable of the same name. Add this function to function saveSettings age .val budget .val weight .val return false Once the values are stored use the jQuery goBack function on the second-to-last line to dismiss the panel and return to the previous page. Next return false to prevent the default action of the submit event that triggers this function. Had we omitted this line the current page would reload which is not what we want. At this point a user can launch the app navigate to the Settings panel enter her settings and .

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.