<%id=request("id") lm="2" ss="0" Sql="select * from news where titleimg<>'' and sh=1 " if lm<>"0" then sql=sql&" and (lm='"&lm&"' or lm2='"&lm&"' or lm3='"&lm&"') " sql=sql&" order by updat asc,id asc " Set rs=server.CreateObject("adodb.recordset") rs.open sql,conn,1,1 total=rs.recordcount i=1 do while not rs.eof if rs("id")=int(id) then page=i if i=1 then ss=rs("id") else ss=ss&","&rs("id") end if rs.movenext i=i+1 loop nar=split(ss,",") if int(page)-1=0 then prepage="" else prepage=nar(page-2) end if if int(page)=total then nextpage="" else nextpage=nar(page) end if %> document.write("page: "); <%if prepage<>"" then%> document.write(" .html\" >Prev"); <%end if%> <% 'for i=lbound(nar) to ubound(nar) if int(total)<=5 then startj=0 endj=total-1 else if int(page)<=5 then startj=0 endj=9 else if int(page)+5<=total then startj=int(page)-6 endj=int(page)+4 else startj=int(page)-6 endj=total-1 End If End If end if ssstr="" eeestr="" %> <%for i=startj to endj if int(page)-1=int(i) then %> document.write("<%=i+1%>");<% else%> document.write(" .html\"> <%=i+1%> "); <%end if%> <%next%> <%if nextpage<>"" then%> document.write(".html\" >Next"); <%end if%> document.write("");