C # Array Value method: ('/', ' \ ' and English double quotes not filtered)
function Checknum () {
To define an array to save special characters
var allnumissame = new Array ("'", "", ",". ","; ",": "," < "," > ","? "," | ","! "," @ "," # "," $ ","% "," ^ "," & "," * "," (",") "," _ "," + ","-"," + ",". ";
Gets the value entered by the user
var Getinputvalue = $ ("#InputChar"). Val ();
Class
var istrueorfalse = false;
Loop for judgment information
for (var i = 0; i < allnumissame.length; i++) {
Judge if the containing lock definition array contains a Word traits classes prompt to True
if (Getinputvalue.indexof (Allnumissame[i])!=-1) {
Istrueorfalse = true;
Break
}
}
False if the prompt for true is true otherwise
if (Istrueorfalse = = True) {
Error prompt alert ("Cannot contain special symbols");
return false;
}
return true;
}
JQuery Regular Expression Filtering method:
if (/[\!\|\#\%\^\&\¥\*\_\-\+\=\ (\) \ (\) \[\]\{\}\\\/\ "\" \ \<\>\, \ "\" \:\;\:\;\ "\" \ "\" \,\,\.\. \) <>?] /GI). Test ("entered value") {
$ ("Inputtip"). HTML ("Member name cannot contain special symbol");
return false;
}