|          
<%on error resume next
 '分页程序
 function fy(scount,pgsize,pg,url)
 'scount记录总数
 'pgsize每面记录数
 'pg当前页
 'url转向的地址,运行本函数后会在后面加上"&page=页号"
 dim pgcount,i,j,mh,k
 mh=chr(34) '不好意思,是双引号
 
 
 'cint()会四舍五入,所以不得不加个k
 k=(scount+pgsize-1)/pgsize
 pgcount=cint((scount+pgsize-1)/pgsize)
 if pgcount>k then pgcount=pgcount-1
 
 response.write "<a href="+mh+url+"&page=1"+mh+">[第一页]</a> "
 if cint(pg)>cint(1) then
 response.write "<a href="+mh+url+"&page="+cstr(pg-1)+mh+">[上一页]</a> "
 end if
 if cint(pg)>5 then
 i=cint(pg)-5
 else
 i=1
 end if
 
 if cint(pgcount)<cint(pg+5)  then
 j=pgcount
 else
 j=pg+5
 end if
 
 
 while cint(i)<=cint(j)
 
 if cint(i)=cint(pg) then
 response.write cstr(i)+" "
 else
 response.write "<a href="+mh+url+"&page="+cstr(i)+mh+">"+cstr(i)+"</a> "
 end if
 i=i+1
 wend
 
 if cint(pgcount)>cint(pg) then
 response.write "<a href="+mh+url+"&page="+cstr(pg+1)+mh+">[下一页]</a> "
 end if
 
 response.write "<a href="+mh+cstr(url)+"&page="+cstr(pgcount)+mh+">[最后页]</a> "
 
 end function
 %>
 |