Hi,
I am new in phpmysql development.I have stuck in problem.
I want to validate user date of birth (only year) using if else if through javascript.
1- if user left it empty then i want it to show message "fill this".
2-else if user's age is less then 20 it will show "not enough".
3-else "welcome".
But if field is empty it show welcome message. please help me in this regard.
Thanks so much.


<html>
<head>
<title>
This is dob validation
</title>
<script language="javascript">
function dobvali()
{
var currentdate=new Date();
var yearonly=currentdate.getFullYear();
var usrdob=document.getElementById('dob').value;
var res=yearonly-usrdob;
if(res20)
{
alert('not enough');
}
else
{
alert('welcome');
}
}
</script>
</head>
<body>
Enter DOB (YYYY):<input type="text" id="dob"/>
<input type="button" value="check" onClick="dobvali();"/>
</body>
</html>