<html>
<head>
<script>
function addYear(fName,daysToAdd)
{
var fDate =new Date(document.dates.Today.value);
fDate.setDate(fDate.getDate()+daysToAdd);
var MM = fDate.getMonth()+1;
var DD = fDate.getDate();
var YY = fDate.getFullYear();
if(MM<10) MM="0"+MM;
if(DD<10) DD="0"+DD;
document.dates.NextYear.value = YY+"-"+MM+"-"+DD;
}
</script>
</head>
<body onLoad="javascript:addYear('NextYear',365)">
<form name="dates">
<input type=text name="Today" value="2010-10-17" size="10">
<input type=text name="NextYear" size="10">
</form>
</body>
</html>
<head>
<script>
function addYear(fName,daysToAdd)
{
var fDate =new Date(document.dates.Today.value);
fDate.setDate(fDate.getDate()+daysToAdd);
var MM = fDate.getMonth()+1;
var DD = fDate.getDate();
var YY = fDate.getFullYear();
if(MM<10) MM="0"+MM;
if(DD<10) DD="0"+DD;
document.dates.NextYear.value = YY+"-"+MM+"-"+DD;
}
</script>
</head>
<body onLoad="javascript:addYear('NextYear',365)">
<form name="dates">
<input type=text name="Today" value="2010-10-17" size="10">
<input type=text name="NextYear" size="10">
</form>
</body>
</html>
Comments
Post a Comment