Created
November 21, 2015 09:57
-
-
Save andu1989anand/f5a768c3149111676696 to your computer and use it in GitHub Desktop.
SAMPLE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script language="javascript"> | |
function aaa() | |
{ | |
date= new Date(); | |
var d = date.getDate(); | |
var m= date.getMonth()+1; | |
var y= date.getFullYear(); | |
document.getElementById('ddd').value=m + '/' + d + '/' + y; | |
} | |
function display() | |
{ | |
var a = document.getElementById('eee').getDate.value; | |
var b = document.getElementById('eee').getMonth.value; | |
var c = document.getElementById('eee').getFullYear.value; | |
//var aa= document.getElementById('eee').(this).('getDate').value; | |
var e= y - c; | |
{ | |
document.write("Ans="+e); | |
} | |
alret(e); | |
} | |
function getAge(dateString) { | |
var today = new Date(); | |
var birthDate = new Date(dateString); | |
var age = today.getFullYear() - birthDate.getFullYear(); | |
var m = today.getMonth() - birthDate.getMonth(); | |
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) { | |
age--; | |
} | |
return age; | |
} | |
</script> | |
</head> | |
<body onload="aaa();"> | |
<form name="xyz" method="post"> | |
CurrentDate:<input type="text" name="ddd" id="ddd" readonly="readonly"> | |
BirthDate:<input type="date" name="eee" id="eee"> | |
Age:<input type="text" name="age" id="age"> | |
<input type="submit" name="submit" value="submit" onClick="display();"> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment