一个过滤特殊字符的JS

<script language="javascript">
function checkForms()
{
var iu, iuu, regArray=new Array("◎","■","●","№","↑","→","↓"+
"!","@","#","$","%","^","&","*","(",")","_","-","+","=","|","","[","]","?","~","`"+
"!","<",">","‰","→","←","↑","↓","¤","§","#","&","&","\","≡","≠"+
"≈","∈","∪","∏","∑","∧","∨","⊥","‖","‖","∠","⊙","≌","≌","√","∝","∞","∮"+
"∫","≯","≮",">","≥","≤","≠","±","+","÷","×","/","Ⅱ","Ⅰ","Ⅲ","Ⅳ","Ⅴ","Ⅵ","Ⅶ","Ⅷ","Ⅹ","Ⅻ","一","二"+
"╄","╅","╇","┻","┻","┇","┭","┷","┦","┣","┝","┤","┷","┷","┹","╉","╇","【","】"+
"三","四","五","六","七","八","九","十","①","②","③","④","⑤","⑥","⑦","⑧","⑨","⑩","┌","├","┬","┼","┍","┕","┗","┏","┅","—"+
"〖","〗","←","〓","☆","§","□","‰","◇","^","@","△","▲","#","℃","※",".","≈","¢");
iuu=regArray.length;
var obj=document.getElementById("username");
if(obj.value=="")
{
alert("用户名不能为空");
obj.focus();
return false;
}
for(iu=1;iu<=iuu;iu++)
{
if(regArray[iu] !="")
{
if (obj.value.indexOf(regArray[iu])!=-1)
{
alert("注册名不可以包含:" + regArray[iu]);
document.Gforms.username.focus();
return false;
}
}
}
return true;
}
</script>
<form method="post" onSubmit="return checkForms();">

        

请输入用户名:<input type="text" name="username">

<input type="submit" name="Submit" value="提交">

</form>

一个过滤特殊字符的JS

上一篇:spring boot 学习(十四)SpringBoot+Redis+SpringSession缓存之实战


下一篇:redis lru实现策略