Verification of mobile phone numbers (starting with 13 and starting with 158,159, 11 digits in total)
Copy codeThe Code is as follows:
Var re;
Var ss = document. getElementById ('textbox3 '). value;
Re =/^ (13 [0-9] {9}) | (15 [89] [0-9] {8}) $/
If (re. test (ss ))
{
Document. getElementById ('label3'). innerText = ""; // assign a value to the label using innerText
}
Else
{
Document. getElementById ('label3'). innerText = "enter the correct mobile phone number! ";
Document. getElementById ('imagebutton1'). disabled = true; // disable disabled for Button
}
Verify the email address (including @ and .)
Copy codeThe Code is as follows:
Var re;
Var ss = document. getElementById (textboxid). value;
Re =/\ w @ \ w * \. \ w/
If (re. test (ss ))
Document. getElementById ('label4'). innerText = "";
Else
{
Document. getElementById ('label4'). innerText = "enter the correct email address! ";
Document. getElementById ('imagebutton1'). disabled = true;
}
Zip code verification (cannot start with 0, 6 digits in total)
Copy codeThe Code is as follows:
Var ss = document. getElementById ('textbox4 '). value;
Var re =/^ [1-9] [0-9] {5} $/
If (re. test (ss ))
Document. getElementById ('label5'). innerText = "";
Else
{
Document. getElementById ('label5'). innerText = "Incorrect zip code format! ";
}
Var r =/^ 13 [012345789] {9}/11 digits starting with 13, the last 9 digits cannot contain 6 digits