• 一个过滤特殊字符的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>
    


  • 相关阅读:
    135、JS和Android交互范例
    《将博客搬至CSDN》
    Android常用工具类
    114、drawable和mipmap 目录下图片的区别
    StringUtils 工具类的常用方法(转载)
    判断当前的Activity的是否处于栈顶
    Git-简单的利用SourceTree提交代码(转载)
    133、 Android 自动化测试(转载)
    c# 利用结构体获取json数据
    如何编写PMP项目管理中的项目立项书
  • 原文地址:https://www.cnblogs.com/Codenewbie/p/3642043.html
Copyright © 2020-2023  润新知