lamborn
01-27-2009, 05:13 AM
Hello,
I am trying to modify the following script.
What I am trying to do is add months to a date which is dependent on user input on a form The user input field is "select2".
This currently works fine if your input in "select 2" does not take you into the next year <as in adding nine months to October>. If it does, the year doesn't move forward one year, it remains as-is <says 2009>
Any thoughts - I am trying to learn.
<!-- Begin
var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
months[11]="November";
months[12]="December";
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getFullYear();
if (year < 2000)
year = year + 1900;
document.write("<center>" + lmonth + " ");
document.write(date + ", " + year + "</center>");
// End -->
</SCRIPT>
<!-- Script Size: 1.00 KB -->
</td>
<td width="10%" bgcolor="#99CCFF">To:</td>
<td width="54%"><SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
months[11]="November";
months[12]="December";
var time=new Date();
var lmonth=months[time.getMonth() + $FORM{'select2'}];
var date=time.getDate();
var year=time.getFullYear();
if (year < 2000)
year = year + 1900;
document.write("<center>" + lmonth + " ");
document.write(date + ", " + year + "</center>");
// End -->
</SCRIPT>
I am trying to modify the following script.
What I am trying to do is add months to a date which is dependent on user input on a form The user input field is "select2".
This currently works fine if your input in "select 2" does not take you into the next year <as in adding nine months to October>. If it does, the year doesn't move forward one year, it remains as-is <says 2009>
Any thoughts - I am trying to learn.
<!-- Begin
var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
months[11]="November";
months[12]="December";
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getFullYear();
if (year < 2000)
year = year + 1900;
document.write("<center>" + lmonth + " ");
document.write(date + ", " + year + "</center>");
// End -->
</SCRIPT>
<!-- Script Size: 1.00 KB -->
</td>
<td width="10%" bgcolor="#99CCFF">To:</td>
<td width="54%"><SCRIPT LANGUAGE="JavaScript1.2">
<!-- Begin
var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
months[11]="November";
months[12]="December";
var time=new Date();
var lmonth=months[time.getMonth() + $FORM{'select2'}];
var date=time.getDate();
var year=time.getFullYear();
if (year < 2000)
year = year + 1900;
document.write("<center>" + lmonth + " ");
document.write(date + ", " + year + "</center>");
// End -->
</SCRIPT>