TAILIEUCHUNG - giới thiều ebook HTML5 và CSS3 in the real world phần 10

Tham khảo tài liệu 'giới thiều ebook html5 và css3 in the real world phần 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ả | Geolocation Offline Web Apps and Web Storage 257 localStorage email email localStorage remember true Now that we have a function to save the visitor s name and email address let s call it if they check the Remember me on this computer checkbox. We ll do this by watching for the change event on the checkbox this event will fire whenever the checkbox s state changes whether due to a click on it a click on its label or a keyboard press js excerpt document .ready function rememberme .change saveData Next let s make sure the checkbox is actually checked since the change event will fire when the checkbox is unchecked as well js excerpt function saveData if rememberme .attr checked var email address .val var name register-name .val localStorage name name localStorage email email localStorage remember true This new line of code calls the jQuery method attr checked which will return true if the checkbox is checked and false if not. Finally let s ensure that Web Storage is present in our visitor s browser 258 HTML5 CSS3 for the Real World js excerpt function saveData if if rememberme .attr checked var email address .val var name register-name .val localStorage name name localStorage email email localStorage remember true else no support for Web Storage Now we re saving our visitor s name and email whenever the checkbox is checked so long as local storage is supported. The problem is we have yet to actually do anything with that data Let s add another function to check and see if the name and email have been saved and if so fill in the appropriate input elements with that information. Let s also precheck the Remember me checkbox if we ve set the key remember to true in local storage js excerpt function loadStoredDetails var name localStorage name var email localStorage email var remember localStorage remember if name name .val name if email email .val name if remember true Geolocation Offline Web .

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.