JavaScript client verification

xiaoxiao2021-03-06  108

/ / Whether it is an integer Function isinteger (STR.Value.Length == 0) {Alert (Title ": can't be empty!"); Str.focus (); return false;} var TMP = PARSEINT (STR. Value) {Alert (Title ": You must enter an integer!"); str.focus (); return false} else f (tmp.tostring () == str.value) { Return True} else {alert (Title ": You must enter an integer!"); str.focus (); return false}}

/ / Whether it is a null value (unfilled) function isfill (str, title) {if (str.value.Length == 0) {alert (title ": can't be empty!"); Str.focus (); Return false;} Return True;

/ / Whether Chinese Function ischinese (STR, TIENGTH == 0) {Alert (Title ": can't be empty!"); Str.focus (); return false;} for (i = 0; I 10000) {} else {alert (Title ": can only enter Chinese!"); Str.focus Return False;}}}

/ / Whether or not the English string function isenglishword (str, title) {if (str.value.Length == 0) {Alert (Title ": can't be empty!"); Str.focus (); Return False; Checken; var i; var j; for (i = 0; i = 65 && checken <= 90 || (Checken> = 97 && checken <= 122)) {} else {alert (Title ": only 26 letters"); str.focus (); return false;}} return true;}} Return true;

/ / Whether the English Digital Function ISEWORDNUMBERANDOTHER (STR, TIENGTH == 0) {Alert (Title ": can't be empty!"); Str.focus (); returnaf false;} var checken VAR i; var j; for (i = 0; i = 48 && checken <= 57) || (Checken> = 65 && checken <= 90) || (checken> = 97 && checken <= 122)) {} else {alert (title ": only numbers and letters"); str.focus () Return false;}}}}} // Is the digital function isnumber (str, title) {if (str.Value.length == 0) {alert (Title ": can't be empty!"); Str.focus (); Var letters = "1234567890."; var i; var c; for (i = 0; i

/ / Whether or not the email format string function isemailformat (str, title) {var emailstr = str.value; var emailpat=/^ (. )@() $/; var matcharray = emailstr.match (emailpat) ; If (matcharray == null) {Alert (Title ": email address must include @ and."); Str.focus (); return false;} return true;}

/ * This is the keyboard event // user can only enter digital function onLiGital () {

Var iCode = Event.Keycode; // Alert (icode); IF (((iCode <48) | ((iCode> 57) && (iCode <96)) || iCode> 105) && ((iCode! = 8 ) && (icode! = 109) && (iCode! = 9) && (iCode! = 229) && (iCode! = 13) && (iCode! = 110) && (icode! = 190) && (iCode! = 46) && (iCode! = 27)) && ((iCode <37) || (iCode> 40))) {Event.ReturnValue = false;}} / * attached: ??? 190, 110: Small ??, 13: Back, 109,189: -, 37: Left arrow?, 38: Downstown?, 39: Right arrow?, 40: Upstairs? ? Word, 96-105: Small ??? word, 9: tab?, 46 :? except * /

/ / Date? Type: Use? You can only enter the character used by the date, ie the word, "-". / * function fntrapalpha () {var icode = event.keycode; if ((iCode <48) || (iCode> 57) && (iCode <96)) || iCode> 105) && ((iCode! = 8 ) && (iCode! = 9) && (iCode! = 190) && (iCode! = 109) && (iCode! = 110) && (iCode! = 189) && (icode! = 37) && (iCode! = 39) && (iCode! = 229) && (iCode! = 27))) {Event.ReturnValue = false; //? sentence? Make? It's enough to get on? }} * /

转载请注明原文地址:https://www.9cbs.com/read-103564.html

New Post(0)