posted 15 years ago
i created calendar in javascript.i tried to show the current date in red colour.but calendar shows every month a day in red colour not only the current month.this da coding,for that,var ss = 1;
for(var xx=day; xx<day+days; xx++){
var holiday = false;
var fulldate = yeare + '-' + (monthe +1) + '-' + ss;
for (var t = 0; t < holidayDates.length-1; t++) {
if (fulldate ==holidayDates[t]){
holiday = true;
break;
}
}
document.calen[xx].value = ss++;
if (holiday)
{
document.calen[xx].style.backgroundColor=bgcolor2;
}
else
if (((xx - Math.floor(xx / 7) *7) == 0) || ((xx - Math.floor(xx / 7) *7) == 6))
{
document.calen[xx].style.backgroundColor=bgcolorWE;
}
else
{
document.calen[xx].style.backgroundColor=bgcolor1;
}
var today = false;
var todayDate = "";
<%
if (today != null) {
%>
todayDate = '<%=sdf.format(today)%>';
<%}%>
if (fulldate == todayDate) {
today = true;
}
if (today) {
document.calen[xx].style.color="#FF0000";
}
}
}