指定table 下的tr 實現隔行變色

来源:互联网 发布:python 企业级架构 编辑:程序博客网 时间:2024/06/06 05:17

如下代碼


<script language="JavaScript" type="text/javascript">$(document).ready(function() {$(".color1 tr:even").css('background-color', '#FFFF00');//奇数行  $(".color1 tr:odd").css('background-color', '#FFD39B');//偶数行});//显示系统当前时间function disptime() {var today = new Date(); //获得当前时间var year = today.getFullYear();//获取当前年份var month = today.getMonth()+1;//获取当前月份var date = today.getDate();//获取当前月份var hh = today.getHours();//獲取時,分,秒var mm = today.getMinutes(); var ss = today.getSeconds();/*设置当前时间*/document.getElementById("myclock").innerHTML = "<tt>目前时间:" +year+"-"+month+"-"+date+"  "+hh+":"+mm+":"+ss+ "</tt>";/* 使用setTimeout在函数disptime()体内再次调用setTimeout 设置定时器每隔1秒(1000毫秒),调用函数disptime()执行,刷新时钟显示 */setTimeout("disptime()", 1000);}setInterval("myrefresh()", 20000); //指定30秒刷新一次function myrefresh(){$("form").submit();}</script>

<table width="100%" border="1" class="color1" ><div><tr><td width="80"><div align="center">工單</div></td><td width="80"><div align="center">數量</div></td><s:iterator value="#routeList"><td width="100"><div align="center">${eqpName }<br>完成數量</div></td></s:iterator></tr><s:iterator value="#zzPenmaSnRecords"><tr> <td><span>${wo}</span></td><td><span>${totailCount }</span></td></tr></s:iterator></div></table>

以上項目中的實際運用,就不改成簡單的了,您應該能看懂.

PS:其它table 下的tr 是不會變色的

1 0
原创粉丝点击