struts+jsp分页页面代码

页面代码

 

<script type="text/javascript">
	/**
	 * 查询结果的页码跳转
	 * @author ozz
	 */
	function jumpTo(flag) {
		var currentPage = parseInt(document.getElementById("currentPage").innerHTML);
		if(flag == "first") {
			currentPage = 1;
		}
		else if(flag == "previous") {
			currentPage = currentPage -1;
		}
		else if(flag == "next") {
			currentPage = currentPage + 1;
		}
		else if(flag == "last") {
			currentPage = document.getElementById("totalPages").innerHTML;
		}
		else if(flag == "goto") {
			currentPage = parseInt(document.getElementById("gotoInput").value);
			if(currentPage>parseInt(document.getElementById("totalPages").innerHTML) || currentPage<1) {
				alert("要转到的页码超过范围!");
				return;
			}
		}
		document.getElementById("currentPageInput").value = currentPage;
		window.document["form1"].submit();
//		window.location.href = "PersonalLoanPreArchAction_searchPLRecord.action?paginationVo.currentPage=" + currentPage;
	}

	window.onload = function() {
		//设置页面切换是否可以显示
		var totalPages = document.getElementById("totalPages").innerHTML;
		var currentPage = document.getElementById("currentPage").innerHTML;//当前页码,初始化时后台返回到页面
		if(currentPage > 1) {
			document.getElementById("first").disabled = false;
			document.getElementById("previous").disabled = false;
		}
		if(currentPage < totalPages) {
			document.getElementById("next").disabled = false;
			document.getElementById("last").disabled = false;
		}
		if(currentPage > 0) {
			document.getElementById("goto").disabled = false;
			document.getElementById("gotoInput").disabled = false;
		}
	}

	function search() {
		document.getElementById("currentPageInput").value = 1;
		window.document["form1"].submit();
	}
</script>
<body>
	<label>第</label><label id="currentPage"><s:property value="paginationVo.currentPage"/></label><label>页, 共</label><label id="totalPages"><s:property value="paginationVo.totalPages"/></label><label>页</label>
	<button id="first" οnclick="jumpTo('first')" disabled="disabled">
		<img src="<%=request.getContextPath() %>/images/button/first.gif" alt="首页">
	</button>
	<button id="previous" οnclick="jumpTo('previous')" disabled="disabled">
		<img src="<%=request.getContextPath() %>/images/button/previous.gif" alt="上一页">
	</button>
	<input id="gotoInput" disabled="disabled">
	<input id="goto" type="button" οnclick="jumpTo('goto')" disabled="disabled" value="转到">
	<button id="next" οnclick="jumpTo('next')" disabled="disabled">
		<img src="<%=request.getContextPath() %>/images/button/next.gif" alt="下一页">
	</button>
	<button id="last" οnclick="jumpTo('last')" disabled="disabled">
		<img src="<%=request.getContextPath() %>/images/button/last.gif" alt="末页">
	</button>
</body>
 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值