function phonenumber(inputtxt)
{
var phoneno = /^\d{10}$/;
if(inputtxt.value.match(phoneno))
{
return true;
}
else
{
alert("Not a valid Phone Number");
return false;
}
}
<form name="gqform">
<input type="text" name="phone" onblur="phonenumber(document.gqform.phone)" required/>
</form>
{
var phoneno = /^\d{10}$/;
if(inputtxt.value.match(phoneno))
{
return true;
}
else
{
alert("Not a valid Phone Number");
return false;
}
}
<form name="gqform">
<input type="text" name="phone" onblur="phonenumber(document.gqform.phone)" required/>
</form>