tailieunhanh - html5 designing rich internet applications visualizing the web phần 10

Tại thời điểm này, bạn có thể lưu tập tin JavaScript của bạn. Bây giờ bạn cần phải thêm các chức năng để hình thành của bạn. Mở "" trong một trình soạn thảo văn bản. Thêm một tham chiếu đến của bạn "mới. js "thư viện, như sau: | 258 PROJECT 5 WORKING WITH JAVASCRIPT return .Validation new Validation jQuery At this point you can save your JavaScript file. Now you need to add the functionality to your form. Open in a text editor. Add a reference to your new . js library as follows script src js script The code you created in your JavaScript file is generic. You need to now associate it directly with a form field. At this point you now can add your validation rules to your form elements in your web page and it could not be easier. You have created three validation rules required email and URL. All you have to do to apply them to a form is to insert a new attribute called validation and specify which rule you would like to apply. Following is an example of the required rule. label Last Name label br input name LastName type text maxlength 25 validation required required The whole form looks like the following. form action submit id html5Form method post fieldset legend Contact Us legend label First Name label br input name FirstName type text maxlength 25 validation required required br br label Middle Name label br input name MiddleName type text disabled - disabled br br label Last Name label br input name LastName type text maxlength 25 validation required required br br label Age label br PROJECT 5 WORKING WITH JAVASCRIPT 259 input name age validation required type number min 18 max 100 br br label Email label br input name email type email validation email required id emailTo br br label How Did you hear about us label br input name HowDidYouHear validation url type uri list mylist br br datalist id mylist option label google value http option label yahoo value http option label Bing value http datalist label When would you like us to contact you label br input name ContactDate validation required type date br br label How many of our .

TÀI LIỆU LIÊN QUAN
TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã 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.