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