1、不能以微博、weibo、官方开头
2、不能包含搜狐、搜狐微博、sohu、souhu
3、可使用大写或者小写字母,但是对应的小写唯一,eg:存在Abc,这abc不可用
4、不允许包含敏感词、不允许使用保留名
这js应该怎么写

解决方案 »

  1.   

    过滤一下啊:伪码如下!
     <html>   <head>  
      
                  <script type="text/javascript">  
                    function check(e) {   
                            var pattern = new RegExp("[\"\\-%&_+`~!@#$^*()<>=|{}':;',\\[\\]./?~!@#¥……*()——|【】‘;:”“'。,、?]");  
                                    return e.value.replace(pattern,'');  
                                        }    
                                         </script>  
                                          </head>   
                                            <body>   
                                               <input type="text" name="username" size=50 onkeydown="value = check(this);" onkeyup="value = check(this);"/>  
                                                </body> 
                                                 </html>