|
Your objective is not entirely clear, but if the idea is that the user enters a number of months ahead to generate a future date, then in principle:-
if (currentMonthValue + numberOfMonthsAhead > 11) { // months are 0-11
futureYear = currentYear +1;
}
<SCRIPT LANGUAGE="JavaScript1.2"> is deprecated - use <script type = "text/javascript"> instead. This should give a clue that this is old code. Of course, <script type = "text/javascript"> must be placed at the top of the script, and not in the middle as you have it.
Also, note that the document.write command must be carried out during the loading of the page. So, if it is attached to any event that executes after the page has loaded, then the whole page will be replaced with the contents of the document.write command.
You cannot have multiple scripts on the same page with the same function and/or global variable names, as the second will simply over-write the first.
“A man ceases to be a beginner in any given science and becomes a master in that science when he has learned that he is going to be a beginner all his life.” Robin G. Collingwood (English Philosopher, 1889-1943)
Last edited by Philip M; 01-27-2009 at 09:25 AM..
|