спасибо вам намного помогло но все ровно есть ошибки
validator.js
function chkPhone(){
var x = document.getElementById("phone");
if (x==null || x=="")
{
alert("Phone no. cannot be left blank");
return false;
}
if(isNaN(x)|| x.indexOf(" ")!=-1)
{
alert("Invalid phone number")
return false;
}
if (x.length > 9)
{
alert("Only 9 characters");
return false;
}
}
function chkSocial(){
var social = document.getElementById("social security");
if (social==null || social=="")
{
alert("social security cannot be left blank");
return false;
}
if(isNaN(social)|| social.indexOf(" ")!=-1)
{
alert("Invalid Social Security ");
return false;
}
if (social.length > 9)
{
alert("Enter only 9 characters for Social Security");
return false;
} else
return true;
}
function chkBirthdate(){
var birthdate = document.getElementById("birth date");
if (birthdate==null || birthdate=="")
{
alert("birth date cannot be left blank");
return false;
}
if(isNaN(birthdate)|| birthdate.indexOf(" ")!=-1)
{
alert("Invalid birth date");
return false;
}
if (birthdate.length > 6)
{
alert("Enter only 6 characters for birth date");
return false;
} else
return true;
}
document.getElementById("phone").onchange = chkPhone;
document.getElementById("social security").onchange = chkSocial;
document.getElementById("birth date").onchange = chkBirthdate;