SoFunction
Updated on 2025-02-28

js verification function code


//Check if it is not empty
function notEmpty(obj, msg)
{
str = ;
str1 = "";
for (i = 0; i < ; i++)
{
if ((i) != " ")
{
str1 = (i, );
break;
}
}
if (str1 == "")
{
alert(msg);
= "";
();
return false;
}
else
{
return true;
}
}
// Check if it is a number
function isNumber(obj, msg)
{
if(isNaN())
{
if (undefined == msg)
{
msg = "Please enter the number!";
}
alert(msg);
();
return false;
}
else
{
return true;
}
}
//Check if the password is the same
function isSamePwd(objPwd1, objPwd2, msg)
{
pwd1 = ;
pwd2 = ;
if (pwd1 != pwd2)
{
if (null == msg)
{
alert("Passwords are different!");
}
else
{
alert(msg);
}
= "";
();
return false;
}
else
{
return true;
}
}
//Check the email address
function isEmail(obj, msg)
{
ch = ;
if((("@") < 1) || ((".") < 1) || ((".") == - 1))
{
if (null == msg)
{
alert("Email is incorrect!");
}
else
{
alert(msg);
}
();
return false;
}
else
{
return true;
}
}