style type="text/css">
th {background-color: red;}
</style>
<script type="text/javascript" src="JScript/jquery-1.5.1.min.js" ></script>
<script type="text/javascript">
$(function() {
$("#tbl tr:nth-child(even)").css("background-color","orange");
$("#tbl tr:nth-child(odd)").css("background-color","green");
})
</script><table id="tbl" border="1">
<tr>
<th>姓名</th>
<th>年龄</th>
<th>所属组</th>
<tr>
<logic:empty name="userList">
<tr id="emptyTr">
<td colspan="3">没有成员</td>
<tr>
</logic:empty>
<logic:notEmpty name="userList">
<logic:iterate id="u" name="userList">
<tr>
<td><bean:write name="u" property="username"/></td>
<td><bean:write name="u" property="age"/></td>
<td><bean:write name="u" property="group.name"/></td>
<tr>
</logic:iterate>
</logic:notEmpty>
</table>
th {background-color: red;}
</style>
<script type="text/javascript" src="JScript/jquery-1.5.1.min.js" ></script>
<script type="text/javascript">
$(function() {
$("#tbl tr:nth-child(even)").css("background-color","orange");
$("#tbl tr:nth-child(odd)").css("background-color","green");
})
</script><table id="tbl" border="1">
<tr>
<th>姓名</th>
<th>年龄</th>
<th>所属组</th>
<tr>
<logic:empty name="userList">
<tr id="emptyTr">
<td colspan="3">没有成员</td>
<tr>
</logic:empty>
<logic:notEmpty name="userList">
<logic:iterate id="u" name="userList">
<tr>
<td><bean:write name="u" property="username"/></td>
<td><bean:write name="u" property="age"/></td>
<td><bean:write name="u" property="group.name"/></td>
<tr>
</logic:iterate>
</logic:notEmpty>
</table>
<th>姓名</th>
<th>年龄</th>
<th>所属组</th>
</tr>
<style type="text/css">
th {background-color: red;}
</style>
<script type="text/javascript" src="jquery-1.4.4.min.js" ></script>
<script type="text/javascript">
$(function() {
$("#tbl tr:nth-child(even)").css("background-color","orange");
$("#tbl tr:nth-child(odd)").css("background-color","green");
})
</script><table id="tbl" border="1">
<tr>
<th>姓名</th>
<th>年龄</th>
<th>所属组</th>
</tr>
<logic:empty name="userList">
<tr id="emptyTr">
<td colspan="3">没有成员</td>
</tr>
</logic:empty>
<logic:notEmpty name="userList">
<logic:iterate id="u" name="userList">
<tr>
<td><bean:write name="u" property="username"/></td>
<td><bean:write name="u" property="age"/></td>
<td><bean:write name="u" property="group.name"/></td>
</tr>
</logic:iterate>
</logic:notEmpty>
</table>
</html>这样应该就可以了
<html>
<style type="text/css">
th {background-color: red;}
</style>
<script type="text/javascript" src="jquery-1.4.4.min.js" ></script>
<script type="text/javascript">
$(function() {
$("#tbl tr:nth-child(even)").css("background-color","orange");
$("#tbl tr:nth-child(odd)").css("background-color","green");
})
</script><table id="tbl" border="1">
<tr>
<th>姓名</th>
<th>年龄</th>
<th>所属组</th>
</tr>
<logic:empty name="userList">
<tr id="emptyTr">
<td colspan="3">没有成员</td>
</tr>
</logic:empty>
<logic:notEmpty name="userList">
<logic:iterate id="u" name="userList">
<tr>
<td><bean:write name="u" property="username"/></td>
<td><bean:write name="u" property="age"/></td>
<td><bean:write name="u" property="group.name"/></td>
</tr>
</logic:iterate>
</logic:notEmpty>
</table>
</html>
<logic:iterate id="u" name="userList">
这样就将循环的行数全变成了蓝色有什么办法先执行完<logic:iterate id="u" name="userList">得到行数,
然后再将循环出来的行,实现隔行变色呢?没人知道么?