//总记录数 function sumRecord() { var conn= Server.CreateObject("ADODB.connection"); var rs= Server.CreateObject("adodb.recordset"); conn.open("PROVIDER=SQLOLEDB;DATA SOURCE=127.0.0.1;UID=sa;PWD=123456;DATABASE=test"); var sql = "select count(*) as RecordCount from baoming"; rs.open(sql,conn); TotalRecords = rs('RecordCount'); } function baoming() { //计算总的页数 TotalPages = (((TotalRecords % PageSize) == 0) ? (TotalRecords / PageSize) : (TotalRecords / PageSize + 1)); //获取传参过来的页数 var toppage; var home = Request.Form("home"); var up = Request.Form("up"); var uppage = parseInt(Request.Form("uppage")); var down = Request.Form("down"); var downpage = parseInt(Request.Form("downpage")); if(home=="首页") { CurPageNum = 1; }else if(up=="上一页") { toppage = uppage; //Response.Write("<mce:script type="text/javascript"><!-- alert('"+toppage+"'); // --></mce:script>"); CurPageNum = toppage-1; //Response.Write("<mce:script type="text/javascript"><!-- alert('"+CurPageNum+"'); // --></mce:script>"); if(CurPageNum <= 0) { CurPageNum = 1; } }else if(down=="下一页") { toppage = downpage; //Response.Write("<mce:script type="text/javascript"><!-- alert('"+toppage+"'); // --></mce:script>"); CurPageNum = toppage+1; //Response.Write("<mce:script type="text/javascript"><!-- alert('"+CurPageNum+"'); // --></mce:script>"); if (CurPageNum >= TotalPages) { CurPageNum = TotalPages; } } var conn= Server.CreateObject("ADODB.connection"); var rs= Server.CreateObject("adodb.recordset"); conn.open("PROVIDER=SQLOLEDB;DATA SOURCE=127.0.0.1;UID=sa;PWD=123456;DATABASE=test"); var sql = "select top "+PageSize+" truename,activeid,chrtel,CONVERT(varchar(30),dtappenddate,20) as dtappenddate from baoming where id not in(select top "+(PageSize*(CurPageNum-1))+" id from baoming order by id desc) order by id desc"; rs.open(sql,conn); var i =0; if(TotalRecords < 1) { Response.write("<mce:script type="text/javascript"><!-- alert('没有记录'); // --></mce:script>"); }else { while(!rs.EOF && i<PageSize) { i++; Response.Write("<tr align='center'>"); Response.Write("<td>"+i +"</td>"); Response.Write("<td>"+ rs('truename') +"</td>"); Response.Write("<td>"+ getActiveNameById(rs('activeid')) +"</td>"); Response.Write("<td>"+ rs('chrtel') +"</td>"); Response.Write("<td>"+ rs('dtappenddate') +"</td>"); Response.Write("</tr>"); rs.movenext; } } rs.close(); conn.close(); rs=null; conn=null; } function page() { Response.Write("<form action='huodong.asp' method='post'><table width='98%' border='0' align='right' cellpadding='0' cellspacing='0'>"); Response.Write("<tr>"); Response.Write("<td>"); Response.Write("<input type='submit' name='home' value='首页'/>"); Response.Write("<input type='hidden' name='homepage' value='1'/>"); Response.Write("<input type='submit' name='up' value='上一页'/>"); Response.Write("<input type='hidden' name='uppage' value='"+(CurPageNum-1)+"'/>"); Response.Write("<input type='submit' name='down' value='下一页'/>"); Response.Write("<input type='hidden' name='downpage' value='"+(CurPageNum+1)+"'/>"); Response.Write("<input type='hidden' name='ChrName' value='"+username+"'/>"); Response.Write("<input type='hidden' name='ChrPwd' value='"+password+"'/>"); //Response.Write("<input type='submit' name='last' value='最后一页'/>"); Response.Write("</td>"); Response.Write("</tr>"); Response.Write("</table></form>"); }