Having a problem and have tried to rework the code and check for errors, but still isn't showing right on my brower. Have also viewed it with two different browsers and cannot figure this one out. Any help would be appreciated!
Under a rolling banner on the page...I want a dynamic greeting to show how many days until a given holiday. Right now the only thing showing is the statement "Leave the party to Midwest Catering" and nothing about days until the closest holiday...Thank s!
Under a rolling banner on the page...I want a dynamic greeting to show how many days until a given holiday. Right now the only thing showing is the statement "Leave the party to Midwest Catering" and nothing about days until the closest holiday...Thank s!
Code:
<HTML>
<HEAD>
<TITLE>Midwest Catering Service</TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- Hide from old browsers
var banners = new Array("banner1.jpg","banner2.jpg","banner3.jpg","banner4.jpg")
var bnrCntr = 0
function bancycle() {
bnrCntr = bnrCntr + 1
if (bnrCntr == 4) {
bnrCntr = 0
}
document.Banner.src = banners[bnrCntr]
setTimeout("bancycle()",3000)
}
var holidayCntMsg = "Leave the party to Midwest Catering"
var curDay = new Date()
var tMonth = curDay.getMonth()
function HolidayDays() {
switch (tMonth) {
case 2:
var tHoliday = new Date("March 17, 2009")
var curHoliday = tHoliday.getTime()-curDay.getTime()
if (curHoliday > 0) {
curHoliday = Math.ceil(curHoliday / (1000 * 60 * 60 * 24))
holidayCntMsg = "Only "+curHoliday+" days until St. Patrick's Day!"
}
break
case 5: case 6:
var tHoliday = new Date("July 4, 2009")
var curHoliday = tHoliday.getTime()-curDay.getTime()
if (curHoliday > 0) {
curHoliday = Math.ceil(curHoliday / (1000 * 60 * 60 * 24))
holidayCntMsg = "Only "+curHoliday+" days until the 4<SUP>th</SUP>of July!"
}
break
case 9:
var tHoliday = new Date("October 31, 2009")
var curHoliday = tHoliday.getTime()-curDay.getTime()
if (curHoliday > 0) {
curHoliday = Math.ceil(curHoliday / (1000 * 60 * 60 * 24))
holidayCntMsg = "Only "+curHoliday+" days until Halloween!"
}
break
case 11:
var tHoliday = new Date("December 25, 2009")
var curHoliday = tHoliday.getTime()-curDay.getTime()
if (curHoliday > 0) {
curHoliday = Math.ceil(curHoliday / (1000 * 60 * 60 * 24))
holidayCntMsg = "Only "+curHoliday+" days until Christmas!"
}
break
}
return holidayCntMsg
}
//-->
</SCRIPT>
</HEAD>
<BODY onload="setTimeout('bancycle()',3000)">
<A NAME="MCS_TOP">
<CENTER><IMG SRC="banner1.jpg" Name="Banner" Width=320 Height=65></CENTER>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- Hide from old browsers
var holidayMsg = HolidayDays()
document.write("<H2><CENTER>"+holidayMsg+"</CENTER></H2>")
//-->
</SCRIPT>
</BODY>
</HTML>
Comment