由于项目主样式限定不可给行设定样式,所以只能一个个单元格设置
.t1 {background-color:#ffff66} //样式定义
.t11 {background-color:#ffff99}
var obj_Continued = document.all('oContinued_job');
var d1 = document.all('text'); //获取单元格对象
var obj_Continue_EndTime = document.getElementsByName('oContinue_EndTime');
var theSecond = 24 * 60 * 60 * 1000 ;
var checkArray = new Array() ;
var nowTime = '${currenttime}';
checkArray = nowTime.split("-");
nowTime = new Date(checkArray[0], checkArray[1], checkArray[2]);
for( i = 0; i < obj_Continue_EndTime.length; i ++ ){
var checkDate = obj_Continue_EndTime[i].value;
//alert(checkDate);2009-06-02 17:00:00.0,80853127
var theOid = checkDate.substring( checkDate.lastIndexOf(",") + 1, checkDate.length );
checkDate = checkDate.substring( 0, checkDate.indexOf(" ") );
checkArray = checkDate.split("-");
checkDate = new Date( checkArray[0], checkArray[1], checkArray[2]); // YYYY-MM-DD
var diffTime = ( checkDate - nowTime ) / theSecond;
if( diffTime == 1 ){
for(var k=0; k<d1.length; k++) {
if(d1[k].value==theOid) {
d1[k].className = "t1";//设置满足条件的单元格的颜色样式
}
}
for( j = 0; j < obj_Continued.length; j ++ ){
if( obj_Continued[j].value == theOid ) {
obj_Continued[j].color = "#000000";//设置字体颜色
}
}
} else {
for(var k=0; k<d1.length; k++) {
if(d1[k].value==theOid) {
d1[k].className = "t11";//不满足条件的使用另外的样式
}
}
for( j = 0; j < obj_Continued.length; j ++ ){
if( obj_Continued[j].value == theOid )
obj_Continued[j].color = "#000000";//设置字体颜色
}
}
}
<!-- 序号 -->
<td align="middle" id="text" value="${continued_job.oid}">
<font id="oContinued_job" value="${continued_job.oid}"><ww:property value="#rowstatus.Index+1" /></font></td>
<!-- 站名 -->
<td align="middle" id="text" value="${continued_job.oid}">
<font id="oContinued_job" value="${continued_job.oid}"><ww:property value="stname"/></font></td>