tailieunhanh - Học JavaScript qua ví dụ part 90

Xác Nhận Thẻ tín dụng Khi chứng thực số thẻ tín dụng, bạn có thể làm một số kiểm tra sơ bộ nhưng có thật xác nhận thẻ được thực hiện trên server thông qua một sản phẩm phần mềm được thiết kế specifi-Cally cho mục đích đó | Form Validation with Regular Expressions 783 EXPLANATION 1 A function called ok_Email is defined. It takes one parameter a reference to the form started on line 6. 2 This got the highest score at http . When you are looking for a regular expression that covers all possibilities you might spend a week and still not have caught everything. This is where the libraries come in handy. Somebody has already done the hard work. 3 The regular expression test method takes the value of the user input and returns true if the pattern in the regular expression matched the user s input. 4 The e-mail address entered is tested to be valid. A true value is returned and the form will be submitted to the server. A valid e-mail address does not mean that if mail is sent to that address it will necessarily be delivered for example san-ta@ is syntactically valid but there is no guarantee that santa is a real user unless you still believe . 5 If an invalid e-mail address was entered the alert box will appear with this message. The ok_Email function will return false and the form will not be submitted. 6 The form named formtest starts here. 7 This is the URL of the CGI script that will be called on the server side when the form is submitted. 8 The onSubmit event handler is triggered when the user clicks the submit button. The value assigned to the event is a function called ok_Email that will return true if the e-mail address is valid and false if not. The form will be sent to the server only if the return value is true. See Figure . Checking for Valid Email Address Please enter your email address peterw@ Send Clear Figure The user enters a valid e-mail address. Credit Card Validation When validating a credit card number you can do some preliminary checking but real card validation is done on the server side through a software product designed specifically for that Before issuing a card there are .

TỪ KHÓA LIÊN QUAN