日期:2014-05-16  浏览次数:20340 次

循环输出问题
for   (var   intLoop   =   1;   intLoop   <   days.length-1;   intLoop++)
  document.write( " <TD   class=calendarTd   id=diary   align= 'center '> "   +   days[intLoop]   +   " </TD> ");

在上面的语句中,要在intloop为偶数的时候,单元格背景是一种图片,为奇数时单元格背景为另一个图片!怎么弄,谢谢?

------解决方案--------------------
for (var intLoop = 1; intLoop < days.length-1; intLoop++)
{document.write( " <TD class=calendarTd id=diary align= 'center ' "
if(intLoop%2==1)
{document.write( "bgcolor= '#ffffff ' ");}
else
{document.write( "bgcolor= '#ffff00 ' ");}

{document.write( "> " + days[intLoop] + " </TD> ");
}