最新發現一個BUG,翻頁在IE8下好好的;在IE6下出問題(點擊頁面不動,可是頁面卻記住了頁碼的標識)。 javascript
<div class="page"> <jsp:include page='/common/page_new.jsp'/> </div>
page_new.jsp html
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <c:if test="${fn:length(page.list)>0}"> <input name="navPageNo" id="navPageNo" type="hidden" value="${page.currentPage}" /> <div class="fl"> 每頁顯示: <select style="width:40px; height:20px;" onchange="subForm('1')" name="pagecount"><option value="5" <c:if test="${page.count eq '5'}">selected</c:if>>5</option><option value="10" <c:if test="${page.count eq '10'}">selected</c:if>>10</option><option value="15" <c:if test="${page.count eq '15'}">selected</c:if>>15</option></select> 共${page.total}條</div> <div class="fr page_right"> <c:if test="${page.hasPreviousPage}"> <a href="javascript:void(0)" class="onepage" title="上一頁" onclick=subForm('${page.currentPage-1}')></a> </c:if> <c:forEach var="x" begin="${(page.currentPage-4)<1?1:(page.currentPage-4)}" end="${(page.currentPage+5)>page.pageCount?(page.pageCount):(page.currentPage+5)}" step="1"> <c:if test="${x!=page.currentPage}"> <a href="javascript:void(0)" class="number" onclick=subForm('${x}')>${x}</a> </c:if> <c:if test="${x==page.currentPage}"> <a href="javascript:void(0)" class="number selectpage">${x}</a> </c:if> </c:forEach> <c:if test="${page.hasNextPage}"> <a href="javascript:void(0)" class="nextpage" title="下一頁" onclick =subForm('${page.currentPage+1}') ></a> </c:if> </div> </c:if> <script type="text/javascript"> function subForm(toPageNum){ var f = document.mainform; f.elements["navPageNo"].value=toPageNum; f.submit(); } </script>緣由IE6下
<A href="javascript:void(0)">點擊</a>點擊連接後不會回到網頁頂部 <A href="#">點擊</a> 點擊後會回到網面頂部再也不執行onclick事件。
只需將href="javascript:void(0)"替換成href="#" 。 java
2: jsp