<%
'飞天论坛分页函数版权归飞天论坛所有
'totalpage总页数
'wzcount总记录数
'wzrep每页记录数
'root图片目录
'pagestr参数字符串用法如
'tyname1,tyname2参数名
'tyvalue1,tyvalue2参数名对应的值
'没有参数时取pagestr=""
'tyname1="a"
'tyname2="b"
'tyname3="c"
'tyvalue1=1
'tyvalue2=2
'tyvalue3=3
'pagestr= "&"&tyname1&"="&tyvalue1&"&"&tyname2&"="&tyvalue2&"&"&tyname3&"="&tyvalue3
'call pageclass(100,3000,30,pagestr)
Function pageclass(totalpage,wzcount,wzrep,pagestr,root)
       Dim wzpage,pagenum
       If Len(Request.QueryString("page"))<>0 Then
          wzpage = clng(Request.QueryString("page"))
         Else 
          wzpage =1
       End If
       If wzpage <= 0 Then wzpage =1
       pagenum = (wzpage \ 10)*10+1
       If wzpage mod 10 = 0 Then pagenum = (wzpage \ 10)*10-9
	        Response.Write ("<table border=""0"" cellspacing=""0"" cellpadding=""0""><tr>"& vbCrLf)
            Response.Write ("<td width=""2""></td><td class=""intd"" title=""主题数"">&nbsp;"& wzcount &"&nbsp;</td>"& vbCrLf)
	        Response.Write ("<td width=""2""></td><td class=""intd"" title=""当前页/总页数"">&nbsp;"&wzpage&"/"& totalpage &"&nbsp;</td>"& vbCrLf)
	        Response.Write ("<td width=""2""></td><td class=""intd"" title=""每页主题数"">&nbsp;"& wzrep &"&nbsp;></td>"& vbCrLf)
       If wzpage > 10 Then
            Response.Write ("<td class=""outtd""><a href=""?page=1"&pagestr&""" title=""首页""><img src="""&root&"images/first.gif"" border=""0""></a></td><td width=""2""></td>"& vbCrLf)
            Response.Write ("<td class=""outtd""><a href=""?page="& pagenum-1 &  pagestr &""" title=""前十页""><img src="""&root&"images/previous.gif"" border=""0""></a></td>"& vbCrLf)
       End If
       For pagenum = pagenum To pagenum + 9
           If pagenum = wzpage Then
		       Response.Write ("<td width=""2""></td><td class=""intd"" title=""当前页"">"& pagenum &"</td>"& vbCrLf)
           Else
		      Response.Write (" <td width=""2""></td><td class=""outtd"" onmouseover=""this.className='intd';"" onmouseout=""this.className='outtd';"">")
			  Response.Write (" <a href=""?page="& pagenum &  pagestr &"""><div style=""width:100%"">"& pagenum &"</div></a></td>"& vbCrLf)
           End If
           If pagenum >= totalpage Then Exit For
       Next

	 If wzpage <= (totalpage - (totalpage mod 10)) Then
            Response.Write ("<td width=""2""></td><td class=""outtd"" onmouseover=""this.className='outtd';"" onmouseout=""this.className='outtd';""><a href=""?page="& pagenum &  pagestr &"""  title=""后十页""><img src="""&root&"images/next.gif"" border=""0""></a></td> "& vbCrLf)
            Response.Write ("<td width=""2""></td><td class=""outtd"" onmouseover=""this.className='outtd';"" onmouseout=""this.className='outtd';""><a href=""?page="& totalpage &  pagestr &"""  title=""末页""><img src="""&root&"images/last.gif"" border=""0""></a></td>"& vbCrLf)
     End If
	 Response.Write (" <td width=""2""></td><td><input class=""inputpage"" name=""page"" type=""text"" size=""3"" onKeyDown=""if(event.keyCode==13) {window.location='?page='+this.value+'"&pagestr&"';}""></td>"& vbCrLf)
	 Response.Write ("</tr></table>"& vbCrLf)
End Function
%>
