一个过滤特殊字符的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的更多相关文章
- jquery过滤特殊字符及js字符串转为数字
//替换特殊字符 $(this).val($(this).val().replace(/[~'!<>@#$%^&*()-+_=:]/g, "")); 方法主要有 ...
- 函数stripslashes去除转义 shopnc 搜索框过滤特殊字符 输入单斜杆会自动转义
如何php是如何处理和过滤特殊字符的呢? 搜索%_显示所有商品:搜索\会在搜索框内叠加\\ 查了一下 magic_quotes_sybase 项开启,反斜线将被去除,但是两个反斜线将会被替换成一个. ...
- JavaScript过滤特殊字符
JavaScript过滤特殊字符 1.设计实例 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ...
- java过滤特殊字符的正则表达式
// 过滤特殊字符 public staticString StringFilter(String str) throws PatternSyntaxException { // 只允许字母和数字 / ...
- Java过滤特殊字符
Java正则表达式过滤 1.Java过滤特殊字符的正则表达式----转载 java过滤特殊字符的正则表达式[转载] 2010-08-05 11:06 Java过滤特殊字符的正则表达式 关键字: j ...
- php有效的过滤html标签,js代码,css样式标签
过滤html标签�php中太简单了,我们可以直接使用strip_tags函数来实现了,下面给各位整理了一些关于 strip_tags函数的例子. php过滤html的函数:strip_tags(str ...
- MVC 记录操作日志与过滤特殊字符
最近进行的MVC系统需要用到记录操作日志和过滤特殊字符的功能,如果每个action中都调用记录日志的方法就太麻烦了,所以根据需要结合mvc的过滤机制 写了个特殊字符验证与记录操作日志的公用类: pub ...
- JSON转换类(一)--过滤特殊字符,格式化字符型、日期型、布尔型
/// <summary> /// 过滤特殊字符 /// </summary> private static string String2Json(String s) { St ...
- C# 过滤特殊字符,保留中文,字母,数字,和-
#region public static string FilterChar(string inputValue) 过滤特殊字符,保留中文,字母,数字,和- /// <summary> ...
随机推荐
- 在JavaScript中对HTML进行反转义
在JavaScript中对字符串进行转义和反转义操作,常用的方法莫过于使用encodeURI (decodeURI).encodeURIComponent (decodeURIComponent)这几 ...
- Ajax_03之接收数据
1.使用XHR接收服务器返回的数据--text 服务器端: header('Content-Type:text/plain'); echo 'xxx'; 客户端: xhr.responseTex ...
- SSIS Design3:并发执行
1,利用优先约束来并发处理数据,Data Flow Task 和 Data Flow Task 1 是并发执行的,而 Data Flow Task2 必须等到 Data Flow Task 和 Dat ...
- 【转】C#调用Windows图片和传真查看器打开图片
//建立新的系统进程 System.Diagnostics.Process process = new System.Diagnostics.Process(); //设置文件名,此处为图片的真实路径 ...
- py2exe使用中遇到的几个问题
问题: 在使用py2exe对所写的python脚本打包成.exe可执行程序时,遇到两个问题: 问题1: RuntimeError: maximum recursion depth exceeded w ...
- CentOS初始化Mysql5.7密码
/etc/init.d/mysql stopmysqld_safe --user=mysql --skip-grant-tables --skip-networking &mysql -u r ...
- Hammer.js分析(四)——recognizer.js
不同识别器会使用不同逻辑,根据从相关Input类获取到的事件对象和事件,实现自定义的触屏事件,例如tap.pinch等. 一.继承关系 Recognizer与前面的Input一样,也相当于是个抽象类. ...
- objective-c 语法快速过(1)
有一定 c++或者 java 基础,过一遍 oc 语法即可,都是相通的,个人认为难点是 oc 的内存管理,虽然有了 ARC,但是也需要学习下,因为有旧软件的维护. 建立在C语言的基础上,增加了一层小范 ...
- ubunt14.04 安装JDK
1.到 Sun 的官网下载 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 选择 ...
- DOM 节点的克隆与删除
无奈的开头 关于DOM节点操作,如果仅仅是根据标准API来操作,那是最简单不过的了.但是现实中却哪有这么容易的问题让我们解决,其实不仅仅是节点的克隆与删除,节点的添加也是如此,而且添加节点需要考虑的情 ...