3.2.0

Script Help Please!

I am doing a webpage for a client, I wanted to add a script that would display the current date and the days left until the next auction (which is his business). I get nothing in the webpage but the table I created for the script to go in. The array is in the head section, the rest in the body. I have to submit the page for approval Monday and am hoping someone out there can tell me where it is I have gone wrong. I sincerely appreicate ANY help! Thanks!


<!--- Date Array --->
<Script Language="JavaScript">
<!--- Hide from non-JavaScript browsers
function AuctionDays(Month, Day, Year) {
var MonthCount = New Array();
MonthCount[1]=31;
MonthCount[2]=28;
MonthCount[3]=31;
MonthCount[4]=30;
MonthCount[5]=31;
MonthCount[6]=30;
MonthCount[7]=31;
MonthCount[8]=31;
MonthCount[9]=30;
MonthCount[10]=31;
MonthCount[11]=30;
if(Year % 4 == 0) {
MonthCount[2]=29;
}
var MonthTotal=0;
for(i=Month;i<12;i++) {
MonthTotal = MonthTotal+MonthCount[i];
}
var DayCount = (25 - Day) + MonthTotal;
return DayCount;
}
function MonthText(Month) {
var MonthNames = New Array();
MonthNames[1]="January";
MonthNames[2]="February";
MonthNames[3]="March";
MonthNames[4]="April";
MonthNames[5]="May";
MonthNames[6]="June";
MonthNames[7]="July";
MonthNames[8]="August";
MonthNames[9]="September";
MonthNames[10]="October";
MonthNames[11]="November";
MonthNames[12]="December";
return MonthNames[Month];
}
//Stop Hiding --->
</Script>
</head>

<!--- Days Left until the next Auction --->
<Center><Table Width=500 Cellpadding=0 Cellspacing=0 BGColor=Gray border=10>
<TR>
<TD VAlign=Top Align=Center>
<Font Size=2><B>
<Script Language="JavaScript">
<!--- Hide from non-JavaScript browsers
var Now =New Date ("September 5, 2005");
var ThisDay =Now.getDate();
var ThisMonth = Now.getMonth()+1;
var ThisYear = Now.getYear();
document.write("Today is " + MonthText(ThisMonth)+" "+ThisDay + "<BR>");
var DaysLeft = AuctionDays(ThisMonth, ThisDay, ThisYear);
if(DaysLeft > 0) {
if(DaysLeft==1) {
document.write("Last day before the Auction!");
} else {
document.write("Only " + DaysLeft + " days until the Auction");
}
} else {
document.write("Thank you from Gard Auctions!");
}
// Stop hiding from other browsers -->
</Script></B></Font>
</TD>
</TR>
</Table>
batt59
August 28,
You have made a JavaScript 101 error many times in this code. The "new" reserved word can not be capitalized. Change them all (I think there are 3 of them) to "new" and things will run much better.
Where are the ActiveWidgets getting used?
Jim Hunter
August 29,

This topic is archived.

See also:


Back to support forum