首页 > 代码库 > 隔行变色
隔行变色
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<center>
<body>
<h1>在线问答</h1><br/>
<a href="http://www.mamicode.com/#">我要提问</a>
<table style="text-align:center">
<tbody>
<tr>
<td>序号</td>
<td>问题</td>
<td>回答次数</td>
<td>最后修改</td>
</tr>
<c:forEach items="${qlist }" var="q" varStatus="status">
<tr <c:if test="${status.count%1==0 }">
style="background-color:lightgreen;color:black"
</c:if>>
<td>${status.count }</td>
<td><a href="http://www.mamicode.com/findAnswers?questionid=${q.id }">${q.title }</a></td>
<td>${q.answercount }</td>
<td>${q.lastmodified }</td>
</tr>
</c:forEach>
</tbody>
<tfoot>
<tr>
<td colspan="4">
<a href="http://www.mamicode.com/findQuestions?curPage=1&pageSize=${pageSize }">首页</a>
<a href="http://www.mamicode.com/findQuestions?curPage=${curPage-1 }&pageSize=${pageSize}"onclick="return checkFirst()">上一页</a>
<a href="http://www.mamicode.com/findQuestions?curPage=${curPage+1 }&pageSize=${pageSize}"onclick="return checkLast()">下一页</a>
<a href="http://www.mamicode.com/findQuestions?curPage=totalPage&pageSize=${pageSize }">末页</a>
</td>
</tr>
</tfoot>
</table>
</body>
</center>
<script type="text/javascript">
function checkFirst(){
if(${curPage>1}){
return true;
}
return false;
};
function checkLast(){
if(${curPage<totalPage}){
return true;
}
return false;
};
</script>
</html>
隔行变色