[thelist] (javascript) changing date

irina kruk irinakruk at yahoo.com
Fri Nov 30 20:09:33 CST 2001


I have this script that indicates a date 5 days ahead,
but it does not change the month and the day. It goes:
November 35... instead of December 4. It works fine
when I use it for current date. When I want 5 days
ahead it stalls. Could someone tell me what I do
wrong?
Thank you.
i.

<!-- Begin
d = new Array(
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
);
m = new Array(
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
);

today = new Date();
day = (today.getDate()+5);
year = today.getYear();

if (year < 2000)    // Y2K Fix, Isaac Powell
year = year + 1900; // http://onyx.idbsu.edu/~ipowell

end = "th";
if (day==1 || day==21 || day==31) end="st";
if (day==2 || day==22) end="nd";
if (day==3 || day==23) end="rd";
day+=end;

document.write("<font face=Arial size=2><b>");
document.write(d[(today.getDay()+5)%7]+",
"+m[today.getMonth()]+" ");
document.write(day+", " + year);
document.write("</font></b>");
// End -->
</script>


__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com




More information about the thelist mailing list