Copy code code as follows:
<script type = "text/javascript">
// Verify general domain name verification
function checkneturl () {
var netUrl = document.GetelementByid ("neturl");
// Verify general domain names, such as www.baidu.com
var regstr = "^^([a-za-z0-9-]+//.) {1,} (com | net | edu | miz | biz | cn | cc) $";
var Re = New RegXP (regstr); // Create regular expression objects
// var Re =/^([a-za-z0-9-]+//.) {1,} (com | net | edu | miz | biz | cn | cc) $/;
if (! Re.exec (neturl.value)) {// Verify whether the input string conforms to the rules
Alert ("The URL address you entered is wrong! The correct format is Mail.Brookes.com");
neturl.focus ();
Return;
}
}
// Mobile phone verification
function iPhoneregeXP () {
var iPhone = document.GetelementByid ("iPhone"). Value;
var regstr = "^((13 [0-9]) | (14 [0-9]) | (15 [^4, // d]) | (18 [0-9])) // d {8 8 } $ ";
var re = new regexp (regstr);
if (! Re.Test (iphone)) {
Alert ("Specification error, correct format such as 152636363 ** (or mobile phone number starting with 13,14,18)");
}
}
// Email check (still a bit bug)
/*Function emailRegexp () {
var email = document.GetelementByid ("email"). Value;
var regstr = "^([[A-Za-Z0-9/U4E00-/U9FA5]*[-_]? [A-Za-Z0-9]) {1,}+@([A-Za-Z0- 9]*[-_]? [A-za-z0-9]+)+[//.] [A-za-z] {2,3} ([//.] [A-za-z] {2})? $ ";
var re = new regexp (regstr);
if (! Re.Test (Email)) {
Alert ("Specification error, correct format such as 152636363 ** (or mobile phone number starting with 13,14,18)");
//iphone.focus ();
}
}*/
// ID card verification
function cardregexp () {
var card = document.GetelementByid ("card"). Value;
var regstr = "(^// d {15} $) | (^// d {18} $) | (^// d {17} (// d | x | x) $)"
var re = new regexp (regstr);
if (! Re.Test (Card)) {
alert ("Input illegal, the correct format is: 4101821897020356 **");
}
}
// Hong Kong and Macau Province Certificate
Function gangaocardregexp () {{) {
var card = document.GetelementByid ("card"). Value;
var regstr = "[az] {1,2} [0-9] {6} [(] {1} [a-z0-9] {1} [)];
var re = new regexp (regstr);
if (! Re.Test (Card)) {
Alert ("Hong Kong and Macao resident ID card input illegal! Correct formats such as: A15263*(E)");
}
}
// Disabled
Function Canjicardregexp () {
var card = document.GetelementByid ("card"). Value;
var regstr = "(^// d {22} $) | (^// d {20} $)";
var re = new regexp (regstr);
if (! Re.Test (Card)) {
alert ("The input of the disability certificate is illegal!");
}
}
//postal code
function postcardregexp () {
var postCard = document.GetelementByid ("Postcard"). Value;
var regstr = "^[0-9] {6} $";
var re = new regexp (regstr);
if (! Re.Test (Postcard)) {
alert ("Enter illegal! The correct format is like 4500!");
}
}
// Fax and fixed telephone verification
function telregexp () {
var Tel = document.GetelementByid ("Tel"). Value;
var regstr = "((^// d {11} $) | (^// d {12} $)) | (^// d {}-// d {8} $) | (^// d {4}-// d {7} $) | (^// d {4}-// d {8} $) "";
var re = new regexp (regstr);
if (! Re.TEL)) {
Alert ("Writing format error! Correct format such as 0511-44052 ** or 021-878888 **");
}
}
// User name verification, the rules are as follows:
// Whether the account is legal (at the beginning of the letter, allowing 5-16 bytes, allowing the letters of letters
function usernameregexp () {{) {
var username = document.GetelementByid ("username"). Value;
var regstr = "^[a-za-z] [a-za-z0-9 _] {3,15} $";
var re = new regexp (regstr);
if (! Re.Test (username)) {
Alert ("You must start with the letter, follow 4-15 digits, let the letters or down the line!");
}
}
// Check an integer
function numregexp () {
var num = document.GetelementByid ("num"). Value;
var regstr = "^[0-9]*[1-9] [0-9]*$";
var re = new regexp (regstr);
if (! Re.Test (num)) {
alert ("Fill in the format error, the correct format is: 8080");
}
}
// Check decimal or integer
function numfontregexp () {
var num = document.GetelementByid ("num"). Value;
var regstr = "^^(([0] {1,}) | ([0-9] {1,}) [.] {1} [0-9] {1,}) | [0-9] { 1,} $ ";
var re = new regexp (regstr);
if (! Re.Test (num)) {
alert ("Fill in the format error, the correct format is 12.3");
}
}
// Verify special characters^[^%$@] {1,} $
function strgexp () {
var str = document.GetelementByid ("Str"). Value;
var regstr = "^%$ &@] {1,} $";
var re = new regexp (regstr);
if (! Re.Test (STR)) {
Alert ("Can't include special characters");
}
}
// Verify the real name
function nameregexp () {
var name = document.GetelementByid ("name"). Value;
var regstr = "((^a-za-z] {1} ([a-za-z _]) {2,20}) | (^/u4e00-/u9fa5] {1}+[a-za -Z0-9/U4E00-/U9FA5] {1,14})) $ ");
var re = new regexp (regstr);
if (! Re.Test (name)) {
Alert ("It should be 2-15 Chinese characters or 3-21 English letters");
}
}
//// Verify passport
function huzhoaregexp () {
var huzhao = document.GetelementByid ("huzhao"). Value;
var regstr = "^((14) | (15) [0-9] {7}) | (g | s | d [0-9] {8}) | (p.) | (s.) [ 0-9] {7}) $ ";
var re = new regexp (regstr);
if (! Re.Test (huzhao)) {
Alert ("The passport input is illegal, the correct format is: G00106556");
}
}
// Officer card
funguanRegexp () {
var junguan = document.GetelementByid ("junguan"). Value;
var regstr = "^[/u4e00-/u9fa5] {1} // d {7} $";
var re = new regexp (regstr);
if (! Re.Test (junguan)) {
Alert ("Enter illegal! Correct format such as: Sea 6042 **");
}
}
// Culture cadre verification
funguanRegexp () {
var wenzhi = document.GetelementByid ("wenzhi"). Value;
var regstr = "^[/u4e00-/u9fa5] {1} text // d {4,12} $";
var re = new regexp (regstr);
if (! Re.Test (wenzhi)) {
Alert ("" Cultural Cadre Certificate Input illegal! Correct formats such as: Guangwen 0816 ** ");
}
}
// Soldier certificate
function shibingRegexp () {
var shibing = document.GetelementByid ("shibing"). Value;
var regstr = "^[/u4e00-/u9fa5] {1,3} // d {4,12} $";
var re = new regexp (regstr);
if (! Re.Test (shibing)) {
Alert ("" Soldiers Certificate input illegal! Correct formats such as: Hubei 176340 ** ");
}
}
// Mobile phone and fixed telephone check
Function iPhonetelRegexp () {{
var iPhonetel = document.GetelementByid ("iPhonetel"). Value;
var regstr = "((^// d {11} $) | (^// d {12} $) | (^// d {3}-// d {8} $) | (^// /d {4}-// d {7} $) | (^// d {4}-// d {8} $) | (^((13 [0-9]) | (14 [0 [0 [0 -9]) | (15 [^4, // d]) | (18 [0-9])) // d {8} $ "$";
var re = new regexp (regstr);
if (! Re.Test (iphonetel)) {
Alert ("" phone number writing error, not in line with the phone number specifications (such as 0511-4405xxx or 15236565xxx), please fill in ");
}
}
</script>