TAILIEUCHUNG - JavaScript Bible, Gold Edition part 131

JavaScript Bible, Gold Edition part 131. This book will bring programmers and non-technical professionals, including casual programmers and scripters, painlessly up to speed on all aspects of mastering JavaScript. Key topics include programming fundamentals, JavaScript language elements and how to use them effectively, and how to easily and efficiently add powerful new functionality to HTML documents and Java applets. | Data-Entry Validation Give users a field in which to enter data and you can be sure that some users will enter the wrong kind of data. Often the mistake is accidental a slip of the pinkie on the keyboard other times users intentionally type the incorrect entry to test the robustness of your application. Whether you solicit a user s entry for client-side scripting purposes or for input into a server-based CGI or database you should use JavaScript on the client to handle validation of the user s entry. Even for a form connected to a CGI script it s far more efficient from the perspective of bandwidth server load and execution speed to let client-side JavaScript get the data straight before your server program deals with it. Real-Time Versus Batch Validation You have two opportunities to perform data-entry validation in a form as the user enters data into a form and just before the form is submitted. I recommend you take advantage of both of these opportunities. Real-time validation triggers The most convenient time to catch an error is immediately after the user makes it especially for a long form that requests a wide variety of information. You can make the user s experience less frustrating if you catch an entry mistake just after the user enters the information his or her attention is already focused on the nature of the content or some paper source material may already be in front of the user . It is much easier for the user to address the same information entry right away. A valid question for the page author is how to trigger the real-time validation. Backward-compatible text boxes have two potential event handlers for this purpose onChange and onBlur. I personally avoid onBlur event handlers especially ones that can display an alert dialog box as a data-entry validation is likely to do . Because a good validation routine brings focus to the errant text box you can get some odd behavior with the interaction of the focus method and the In This Chapter Validating

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
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.