jsp页面中对表格实现隔行变色方法


在jsp页面中为表格添加各行变色的方法
<c:forEach var="student" items="${ students}" varStatus="status">
<c:if test=”${status.index % 2 == 0}”>
<tr class = "even"> --偶数行
........
</tr>

</c:if>
<c:if test=”${status.index % 2 == 1}”>
<tr class = "odd"> --奇数行
........
</tr>

</c:if>
</c:forEach>

然后:
写两个类样式就好了 如:

<style type="text/css">
.even { background : white;}

.odd { background : blue;}
</style>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM