自已写的一个分页函数;贴出来,大家给PP function showpage(table,size,page,url) set rst=server.CreateObject("adodb.recordset") sql="select count(*) from "&table&" " rst.open sql,conn,3,2 cot=int(rst(0)/size) ca=rst(0) mod size if ca<>0 then cot=cot+1 else cot=cot end if response.Write"共"&rst(0)&"条 每页"&size&"条 页次:"&page&"/"&cot&" " if page=1 then response.Write "[首页] [上页] " else response.Write"[<a href="&url&"?page=1>首页</a>] [<a href="&url&"?page="&page-1&">上页</a>] " end if if page=cot then response.Write "[下页] [尾页] " else response.Write"[<a href="&url&"?page="&page+1&">下页</a>] [<a href="&url&"?page="&cot&">尾页</a>] " end if response.Write"<select name='page' onchange='selected()'>" for i=1 to cot response.Write"<option value='"&i&"'" if i=page then response.Write "selected" response.Write">"&i&"</option>" next response.Write"</select>"
response.Write"<script>" response.Write"function selected(){" response.Write"var x=document.all.page.options[document.all.page.selectedIndex].value;" response.Write"window.location='"&url&"?page='+x;" response.Write"}</script>" rst.close set rst=nothing end function