<%@ page import="zhengcechaxun.Pd_zhengce" %> <%@ page import="zhengcechaxun.Thesql" %> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta charset="utf-8" /> <title>科技政策查询系统</title> <style type="text/css"> .wenzi { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } table { border-collapse: collapse; border-spacing: 0; } /* 表头 */ .cloudTable_header tr { background-color: #efeff1; } .cloudTable_header th { min-width: 0; box-sizing: border-box; text-overflow: ellipsis; vertical-align: middle; position: relative; border-bottom: 1px solid #e0e6ed; border-right: 1px solid #e0e6ed; padding: 10px 0px; white-space: nowrap; overflow: hidden; font-weight: bold; text-align:center; } /* 表身体 */ .cloudTable_body tr td { height: 40px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; box-sizing: border-box; -webkit-box-sizing: border-box; font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; } .cloudTable_body tr td { box-sizing: border-box; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; border-right: 1px solid #e0e6ed; } .cloudMtxTable_body{ /*height:102px;*/ height:402px; width:100%; overflow-y: auto; border-bottom: 1px solid #e0e6ed; } /* 公用样式 */ .data-cell { padding-left: 15px; padding-right: 15px; font-family: 'Lato', 'Helvetica Neue', Arial, Helvetica, sans-serif; } .cloudTable_body tr:hover { background-color: #c5e8fe; } </style> </head> <% String name=request.getParameter("name"); String document=request.getParameter("document"); String organ=request.getParameter("organ"); int len; Pd_zhengce[] pddsall=null; Thesql thesql; if(name==null){name="";} if(document==null){document="";} if(organ==null){organ="";} thesql=new Thesql(); pddsall=thesql.policy_DimQuery(name,document,organ); len= pddsall.length; %> <body onl oad="goPage(1,10);"> <div align="center" onclick="pageClick(this)" class="active" style="font-size:35px"><img width="60px" height="60px" align="center" src="LOGO.png" />科技政策查询</div> <div> <form action="index.jsp" method="get"> <table style="width:80%;height:80%" border="0" align="center"> <tr> <td colspan=2 style="height:12%;font-size:20px" align="center"> 政策名称 <input type="text" size="10px" style="height:30px" name="name"> 发文编号 <input type="text" size="10px" style="height:30px" name="document"> 发文机构 <input type="text" size="10px" style="height:30px" name="organ"> <button id="select" style="width:70px;height:40px">查询</button> </td> </tr> <tr> <%-- <td style="width:1%"></td>--%> <td style="width:100%"> <table id="idData" width="100%" height="100%" border="0" style="font-size:18px" cellspacing=1> <%for(int i=0;i<len;i++) { if(i%9==0){%> <tr><td style="height:40px;width:500px" align="center">政策名称 </td> <td style="height:40px;width:300px" align="center"> 发文机构 </td> <td style="height:40px;width:200px" align="center"> 颁布日期 </td> <td style="height:40px;width:200px" align="center"> 政策分类 </td> <td style="height:40px;width:200px" align="center"> 操作</td></tr> <%} %> <%-- <div style="width:80px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;" title="<%=pddsall[i].name%>">--%> <%-- <%=pddsall[i].name%>--%> <tr><td style="height:40px;width:477px;"><div style="width:450px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;"><%out.print(pddsall[i].name);%></div></td> <td style="height:40px;width:290px" align="center"><div style="width:150px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;"><%out.print(pddsall[i].organ);%></div></td> <td style="height:40px;width:200px" align="center"> <%out.print(pddsall[i].pubdata); %> </td> <td style="height:40px;width:200px" align="center"><div style="width:150px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;"><%out.print(pddsall[i].type); %></div></td> <td style="height:40px;width:200px" align="center"> <a href="">查看</a></td></tr> <%} %> </table> </td> </tr> <tr> <td colspan=5 style="height:10%;" align="center"> <br><br><br> <table width="100%" align="center"> <tr><td style="font-size:14px;" align="center"><div id="barcon" name="barcon"></div></td></tr> </table> <script type="text/javascript"> /** * 分页函数 * pno--页数 * psize--每页显示记录数 * 分页部分是从真实数据行开始,因而存在加减某个常数,以确定真正的记录数 * 纯js分页实质是数据行全部加载,通过是否显示属性完成分页功能 **/ function goPage(pno,psize){ var itable = document.getElementById("idData"); var num = itable.rows.length;//表格所有行数(所有记录数) console.log(num); var totalPage = 0;//总页数 var pageSize = psize;//每页显示行数 //总共分几页 if(num/pageSize > parseInt(num/pageSize)){ totalPage=parseInt(num/pageSize)+1; }else{ totalPage=parseInt(num/pageSize); } var currentPage = pno;//当前页数 var startRow = (currentPage - 1) * pageSize+1;//开始显示的行 31 var endRow = currentPage * pageSize;//结束显示的行 40 endRow = (endRow > num)? num : endRow; 40 console.log(endRow); //遍历显示数据实现分页 for(var i=1;i<(num+1);i++){ var irow = itable.rows[i-1]; if(i>=startRow && i<=endRow){ irow.style.display = "block"; }else{ irow.style.display = "none"; } } var pageEnd = document.getElementById("pageEnd"); var tempStr = "共"+num+"条记录 分"+totalPage+"页 当前第"+currentPage+"页"; if(currentPage>1){ tempStr += "<a href=\"#\" onClick=\"goPage("+(1)+","+psize+")\">首页</a>"; tempStr += "<a href=\"#\" onClick=\"goPage("+(currentPage-1)+","+psize+")\"><上一页</a>" }else{ tempStr += "首页"; tempStr += "<上一页"; } if(currentPage<totalPage){ tempStr += "<a href=\"#\" onClick=\"goPage("+(currentPage+1)+","+psize+")\">下一页></a>"; tempStr += "<a href=\"#\" onClick=\"goPage("+(totalPage)+","+psize+")\">尾页</a>"; }else{ tempStr += "下一页>"; tempStr += "尾页"; } document.getElementById("barcon").innerHTML = tempStr; } </script> </td> </tr> </table></form> </div> </body> </html>
标签:总结,num,18,23.4,tempStr,nbsp,text,overflow,border From: https://www.cnblogs.com/laobing6214/p/17331102.html