JavaScript can be used to validate these input data in an HTML form before the data is sent to the server.
The typical form data that is validated by JavaScript is:
• Has the user filled out the required items in the form?• Is the email address that the user entered legal?• Has the user entered a valid date?• Does the user enter text in the Data field (numeric field)?
Here is the complete
Detailed description of JavaScript ID card number validation and instance code, and detailed description of javascript
Recently, you need to verify the validity of your ID card. real-name verification is not expected. However, the original verification rules are too simple, but they simply verify the length of your ID
This cell phone number is the correct validation function can be said to be the latest support, which has a detailed description, no matter what the next increase in the number of sections we are very easy to modify a little bit.
JavaScript phone number Regular expression validation function
Copy Code
JavaScript method to verify, of course, if the simultaneous use of 2 ways to verify the most insurance, but (Khan ...). We are tired of the programmers:)
This explains the 2 ways in which form validation is made, and the following is the concept of dynamically generating JavaScript. Why do you want to generate it dynamically? Because this kind of client authent
Although Prototype.js is also used to write, the implementation of the class is still using the method in JavaScript advanced programming because of its lack of understanding. When using AJAX for data validation, XML was used initially as a data source, but after a period of time, XML was found to be inefficient, and JSON was used as the data source.
A year has passed, the customer has put forward new requ
of the property you want to verify! }}//Determine if the character entered is Chinese function ischinese () {var str = Document.getelemeNtbyid (' str '). Value.trim ();
if (str.length!=0) {reg=/^[\u0391-\uffe5]+$/; if (!reg.test (str)) {alert ("Sorry, the string type you entered is not well-formed!");
/Please replace "string type" with the name of the property you want to verify!
}//Determine if the email format entered is correct function isemail () {var str = document.getElementById (' str
javascript| Form Validation | functions
check.js js function file
/////////////////////////////////////////////////////////////////////////////////**---------------Common validation checkform (oform) for client forms-----------------* Function: Universal validation of all form elements.Use* * * * * AUTHOR:WANGHR100 (Gr
javascript| Form Validation | dynamic
Online down an ASP dynamic generated form to verify JavaScript code, the expansion of their own. I have forgotten the name of the author, but I remember clearly that the code from the first to the Nineth is the author's original one. As
Cases
Add the onsubmit attribute to the form or the Add OnClick property of the Submit button, the value is return check (), the check is a JavaScript function, the validation table is single, no call, even if the validation fails will be submitted. In the check function, the validation failure returns false and retur
The CheckBox control, because its value is selected and not selected. Therefore, when submitting the data, want to let the user must choose CheckBox, under normal circumstances, not to do validation.
But we can use Asp:customvalidator to verify, but we have to write custom validation JavaScript code, can refer to the
Copy Code code as follows:
Http://
JavaScript Validation Form Encyclopedia
1. Length Limit
Copy Code code as follows:
2. Can only be Chinese characters
3. "Can only be English
Copy
JavaScript Form Validation Regular expression encyclopedia
Using regular expressions to determine whether the Arabic numerals are 0-9
Copy Code code as follows:
function Regisdigit (fdata)
{
var reg = new RegExp ("^[0-9]$");
Return (Reg.test (fdata));
}
Use this expression to get the len
Fuchangxi's Regular:Copy CodeThe code is as follows:/^ ([0-9a-za-z\-_\.] +) @ ([0-9a-z]+\. [A-z] {2,3} (\. [A-z] {2})?) $/g The start must be one or more word characters or--plus @, then one or more word characters or--. Then the point is "." and a combination of word characters and--can have one or more combinations.Copy CodeThe code is as follows:I don't quite understand the specific rules of the mailbo
JavaScript Tutorial date format validation code
Increase the pricenbsp; nbsp;nbsp;nbsp;This site original article reproduced annotated from Www.111cn.net*/
Article Introduction: easy to use jquery form verification plug-in--jquery.validate.js.
Jquery.validate.js is a validation plug-in for jquery, and with the advantage of jquery, we can quickly validate some of the common inputs and expand our own authentication methods. Please download the necessary jquery plugins before using: Jquery-1.4.2.min.js and Jquery.validate.min.js.
The following shows how to use the Jquery.validate.js plug-in to
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.