function isEmail (s) //判断是否是正确的EMAIL格式
{
if (isEmpty(s))
{
window.alert("输入的E-mail地址不能为空,请输入");
return false;
}
if (isWhitespace(s))
{
window.alert("输入的E-mail地址中不能包含空格符,请重新输入");
return false;
}
var i = 1;
var len = s.length;
if (len > 50)
{
window.alert("email地址长度不能超过50位");
return false;
}
pos1 = s.indexOf("@");
pos2 = s.indexOf(".");
pos3 = s.lastIndexOf("@");
pos4 = s.lastIndexOf(".");
if ((pos1 <= 0)||(pos1 == len)||(pos2 <= 0)||(pos2 == len))
{
window.alert("请输入有效的E-mail地址");
return false;
}
else
{
if( (pos1 == pos2 - 1) || (pos1 == pos2 + 1) || ( pos1 != pos3 )|| ( pos4 < pos3 ) )
{
window.alert("请输入有效的E-mail地址");
return false;
}
}
if ( !isCharsInBag( s, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@"))
{
window.alert("email地址中只能包含字符ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.-_@/n" + "请重新输入" );
return false;
}
return true;
}
function Verifyhanzi(str) //判断是不是汉字
{
for (nIndex=0; nIndex<str.length; nIndex++)
{
cCheck = str.charAt(nIndex);
if (isnumber(cCheck)|| IsAlpha(cCheck) || cCheck=='-' || cCheck=='_'|| cCheck==' '|| cCheck=='#'|| cCheck=='*'|| cCheck=='('|| cCheck==')'|| cCheck=='.'|| cCheck==';')
{
return false;
}
}
return true;
}