判断是否为汉字的函数
判断是否为email的函数
function checkchar(str)
{
var temp=str.length;
for (i=0;i<temp;i++)
{
if ((str.charCodeAt(i)>57) && (str.charCodeAt(i)<65))
{
return false;
}
if ((str.charCodeAt(i)>90)&&(str.charCodeAt(i)<97))
{
return false;
}
if (str.charCodeAt(i)<48)
{
return false;
}
if ((str.charCodeAt(i)>122))
{
return false;
}
}
return true;
}
判断是否为数字的函数
{
var temp=str.length;
for (i=0;i<temp;i++)
{
if ((str.charCodeAt(i)>57) && (str.charCodeAt(i)<65))
{
return false;
}
if ((str.charCodeAt(i)>90)&&(str.charCodeAt(i)<97))
{
return false;
}
if (str.charCodeAt(i)<48)
{
return false;
}
if ((str.charCodeAt(i)>122))
{
return false;
}
}
return true;
}
function checknum(str)
{
var temp=str.length;
for (i=0;i<temp;i++)
{
if (str.charCodeAt(i)>57)
{
return false;
}
if (str.charCodeAt(i)<48)
{
return false;
}
}
return true;
}
{
var temp=str.length;
for (i=0;i<temp;i++)
{
if (str.charCodeAt(i)>57)
{
return false;
}
if (str.charCodeAt(i)<48)
{
return false;
}
}
return true;
}
function checknum(obj)
{
var pattern=/^\d+$/ ;
if(!pattern.exec(obj.value)){
alert("请输入数字");
return false;}
}
var pattern=/^\d+$/ ;
if(!pattern.exec(obj.value)){
alert("请输入数字");
return false;}
}
判断是否为email的函数
function emailcheck(email)
{
var yufan = /^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/;
if(yufan.test(email))
{
return true;
}
return false;
}
{
var yufan = /^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/;
if(yufan.test(email))
{
return true;
}
return false;
}