bigsilk Posted September 3, 2009 Share Posted September 3, 2009 I downloaded and installed a calendar for a template I'm building. Chrome, Opera and Safari display it properly. IE8 and FF don't. As a matter of fact, it completely ruins the page.Why?Here's the js: function buildCal(m, y, cM, cH, cDW, cD, brdr){var mn=['January','February','March','April','May','June','July','August','September','October','November','December'];var dim=[31,0,31,30,31,30,31,31,30,31,30,31];var oD = new Date(y, m-1, 1); //DD replaced line to fix date bug when current day is 31stoD.od=oD.getDay()+1; //DD replaced line to fix date bug when current day is 31stvar todaydate=new Date() //DD addedvar scanfortoday=(y==todaydate.getFullYear() && m==todaydate.getMonth()+1)? todaydate.getDate() : 0 //DD addeddim[1]=(((oD.getFullYear()%100!=0)&&(oD.getFullYear()%4==0))||(oD.getFullYear()%400==0))?29:28;var t='<div class="'+cM+'"><table class="'+cM+'" cols="7" cellpadding="0" border="'+brdr+'" cellspacing="0"><tr align="center">';t+='<td colspan="7" align="center" class="'+cH+'">'+mn[m-1]+' - '+y+'</td></tr><tr align="center">';for(s=0;s<7;s++)t+='<td class="'+cDW+'">'+"SMTWTFS".substr(s,1)+'</td>';t+='</tr><tr align="center">';for(i=1;i<=42;i++){var x=((i-oD.od>=0)&&(i-oD.od<dim[m-1]))? i-oD.od+1 : ' ';if (x==scanfortoday) //DD addedx='<span id="today">'+x+'</span>' //DD addedt+='<td class="'+cD+'">'+x+'</td>';if(((i)%7==0)&&(i<36))t+='</tr><tr align="center">';}return t+='</tr></table></div>';}Here's the HTML/js:<div id="cal_box"><script type="text/javascript">var todaydate=new Date()var curmonth=todaydate.getMonth()+1 //get current month (1-12)var curyear=todaydate.getFullYear() //get current yeardocument.write(buildCal(curmonth ,curyear, "main", "month", "daysofweek", "days", 1));</script></div> Link to comment Share on other sites More sharing options...
justsomeguy Posted September 3, 2009 Share Posted September 3, 2009 Is that all the HTML? What is the CSS for the classes you're telling it to use? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.