带跳转的分页
# Z J2 m) ~$ D8 n* E4 yfunction fy(sql,page,pagelistnum,link) dim rs,znum,zpage page=cint(page) '将page转换为整型 set rs=server.createobject("adodb.recordset") rs.open sql,conn,1,1 znum=rs.recordcount '得到总记录条数 zpage=znum\pagelistnum '总记录除以每页条数得到总页数 if znum mod pagelistnum >0 then zpage=zpage+1 response.Write("<form name=MyForm method=get>") response.write "共" & zpage & "页 第" & page & "页 " if page=1 then response.write "第一页 上一页 " else response.write"<a href=" & link & "&page=1> 第一页 </a> <a href=" & link & "&page="&page-1&">上一页 </a>" end if if page<zpage then response.write "<a href=" & link & "&page=" & page+1 & ">下一页 </a> <a href=" & link & "&page=" & zpage & ">最后页 </a>" else response.write "下一页 最后一页 " end if 9 u5 u2 n# E5 K' c1 r. O
'创建下拉列表 Response.Write("第<select size=1 name=Page onchange=PageCurrent()>") For i=1 to zpage if page="" then if zpage=1 then Response.Write("<option selected>1</option>") Response.Write("<option selected>"&i&"</option>") ''当前页码 else Response.Write("<option>"&i&"</option>") end if Next response.Write("</select></form>") rs.close set rs=nothing end function |