Find Age Using jscript

Dotnetfundakumar
Posted by Dotnetfundakumar under JavaScript category on | Views : 1687
< html xmlns="http://www.w3.org/1999/xhtml" >
< head runat="server" >
< title > Untitled Page< /title >
< script >
function test1()
{
var tdate=new Date()
var cud=tdate.getDate()
var cum=tdate.getMonth()
var cuyr=tdate.getFullYear()
var pr=document.getElementById("txtdob").value;
var pryr=pr.split("/")
var cuage=cuyr-pryr[2];
alert("Your age : "+ cuage);
}

< /script >
< /head >



< body >
< form id="form1" runat="server" >

< asp:TextBox ID="txtdob" runat ="server" onfocusout="test1();" > (dd/mm/yyyy)< /asp:TextBox >

< /form >
< /body >
< /html >

Comments or Responses

Login to post response