JavaScript验证表单大全
2007-07-06 16:24
495 查看
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<script>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:校验ip地址的格式
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:strIP:ip地址
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:如果通过验证返回true,否则返回false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function isIP(strIP) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if (isNull(strIP)) return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var re=/^(d+).(d+).(d+).(d+)$/g //匹配IP地址的正则表达式
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(re.test(strIP))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if( RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256) return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入字符串是否为空或者全部都是空格
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:str
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
如果全是空返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function isNull( str )...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if ( str == "" ) return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var regu = "^[ ]+$";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var re = new RegExp(regu);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return re.test(str);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入对象的值是否符合整数格式
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:str 输入的字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function isInteger( str )...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
var regu = /^[-]...{0,1}[0-9]...{1,}$/;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return regu.test(str);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入手机号码是否正确
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
s:字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function checkMobile( s )...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
var regu =/^[1][3][0-9]...{9}$/;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var re = new RegExp(regu);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if (re.test(s)) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
}else...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入字符串是否符合正整数格式
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
s:字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function isNumber( s )...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var regu = "^[0-9]+$";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var re = new RegExp(regu);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if (s.search(re) != -1) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
} else ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入字符串是否是带小数的数字格式,可以是负数
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
s:字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function isDecimal( str )...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(isInteger(str)) return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
var re = /^[-]...{0,1}(d+)[.]+(d+)$/;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if (re.test(str)) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(RegExp.$1==0&&RegExp.$2==0) return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
} else ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入对象的值是否符合端口号格式
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:str 输入的字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function isPort( str )...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return (isNumber(str) && str<65536);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入对象的值是否符合E-Mail格式
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:str 输入的字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function isEmail( str )...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
var myReg = /^[-_A-Za-z0-9]+@([_A-Za-z0-9]+.)+[A-Za-z0-9]...{2,3}$/;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(myReg.test(str)) return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入字符串是否符合金额格式
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
格式定义为带小数的正数,小数点后最多三位
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
s:字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function isMoney( s )...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var regu = "^[0-9]+[.][0-9]{0,3}$";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var re = new RegExp(regu);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if (re.test(s)) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
} else ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入字符串是否只由英文字母和数字和下划线组成
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
s:字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function isNumberOr_Letter( s )...{//判断是否是数字或字母
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var regu = "^[0-9a-zA-Z_]+$";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var re = new RegExp(regu);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if (re.test(s)) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
}else...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入字符串是否只由英文字母和数字组成
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
s:字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function isNumberOrLetter( s )...{//判断是否是数字或字母
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var regu = "^[0-9a-zA-Z]+$";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var re = new RegExp(regu);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if (re.test(s)) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
}else...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入字符串是否只由汉字、字母、数字组成
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
value:字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function isChinaOrNumbOrLett( s )...{//判断是否是汉字、字母、数字组成
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var regu = "^[0-9a-zA-Z一-龥]+$";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var re = new RegExp(regu);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if (re.test(s)) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
}else...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:判断是否是日期
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:date:日期;fmt:日期格式
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function isDate( date, fmt ) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if (fmt==null) fmt="yyyyMMdd";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var yIndex = fmt.indexOf("yyyy");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(yIndex==-1) return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var year = date.substring(yIndex,yIndex+4);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var mIndex = fmt.indexOf("MM");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(mIndex==-1) return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var month = date.substring(mIndex,mIndex+2);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var dIndex = fmt.indexOf("dd");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(dIndex==-1) return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var day = date.substring(dIndex,dIndex+2);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(!isNumber(year)||year>"2100" || year< "1900") return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(!isNumber(month)||month>"12" || month< "01") return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(day>getMaxDay(year,month) || day< "01") return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function getMaxDay(year,month) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(month==4||month==6||month==9||month==11)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return "30";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(month==2)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(year%4==0&&year%100!=0 || year%400==0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return "29";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return "28";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return "31";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:字符1是否以字符串2结束
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:str1:字符串;str2:被包含的字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
function isLastMatch(str1,str2)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var index = str1.lastIndexOf(str2);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(str1.length==index+str2.length) return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:字符1是否以字符串2开始
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:str1:字符串;str2:被包含的字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
function isFirstMatch(str1,str2)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var index = str1.indexOf(str2);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(index==0) return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:字符1是包含字符串2
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:str1:字符串;str2:被包含的字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
function isMatch(str1,str2)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var index = str1.indexOf(str2);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(index==-1) return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入的起止日期是否正确,规则为两个日期的格式正确,
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
且结束如期>=起始日期
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
startDate:起始日期,字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
endDate:结束如期,字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function checkTwoDate( startDate,endDate ) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if( !isDate(startDate) ) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
alert("起始日期不正确!");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
} else if( !isDate(endDate) ) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
alert("终止日期不正确!");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
} else if( startDate > endDate ) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
alert("起始日期不能大于终止日期!");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入的Email信箱格式是否正确
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strEmail:字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function checkEmail(strEmail) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//var emailReg = /^[_a-z0-9]+@([_a-z0-9]+.)+[a-z0-9]{2,3}$/;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var emailReg = /^[w-]+(.[w-]+)*@[w-]+(.[w-]+)+$/;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if( emailReg.test(strEmail) )...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
}else...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
alert("您输入的Email地址格式不正确!");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//*
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
用途:检查输入的电话号码格式是否正确
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
输入:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strPhone:字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
返回:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
如果通过验证返回true,否则返回false
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
*/
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
function checkPhone( strPhone ) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
var phoneRegWithArea = /^[0][1-9]...{2,3}-[0-9]...{5,10}$/;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
var phoneRegNoArea = /^[1-9]...{1}[0-9]...{5,8}$/;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var prompt = "您输入的电话号码不正确!"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if( strPhone.length > 9 ) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if( phoneRegWithArea.test(strPhone) )...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
}else...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
alert( prompt );
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
}else...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if( phoneRegNoArea.test( strPhone ) )...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
}else...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
alert( prompt );
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</script>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<form name=a onsubmit="return checkPhone(document.a.b.value);">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<INPUT TYPE="text" NAME="b">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<input type="submit" name="Submit" value="check">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</form>
相关文章推荐
- JavaScript表单验证大全(一)
- Javascript表单验证大全
- JavaScript验证表单函数大全
- 超全超实用的Javascript类库和jQuery插件大全之一:Web表单和输入验证
- JavaScript表单验证大全
- javaScript表单验证大全
- js验证表单大全,超级的强悍的javascript代码(转载)
- js验证表单大全,用JS控制表单提交 ,javascript提交表单:
- JavaScript验证表单大全
- JavaScript验证表单大全
- js验证表单大全,用JS控制表单提交 ,javascript提交表单
- JavaScript验证表单大全【自用】
- javascript表单验证大全
- 超全超实用的Javascript类库和jQuery插件大全之一:Web表单和输入验证
- JavaScript验证表单大全
- JavaScript验证表单函数大全
- js验证表单大全,用JS控制表单提交 ,javascript提交表单,表单提交 所有js判断
- JavaScript验证表单大全参考
- javaScript表单验证大全
- js验证表单大全,用JS控制表单提交 ,javascript提交表单