[code]<%
Function showPage(currentPage,countPage,showPageC,queryStr)
Dim i,l,starF,endF,reStr,getStr
Const DOT="<span style=cursor:hand;>..</span>"
l=showPageC\2
If currentPage-l<=1 Then
starF=1
Else
starF=currentPage-l
reStr=reStr & DOT
End If
endF=starF+showPageC
For i=starF To endF
If i>countPage Then Exit For
If queryStr="" Then
getStr="cp=" & i
Else
getStr=queryStr & "&cp=" & i
End If
If i<>currentPage Then
reStr=reStr & "<a href=""?" & getStr & """ target=_self class=page>[" & i & "]</a> "
Else
reStr=reStr & "<b><font color=#CC9933>[" & i & "]</a></b> "
End If
Next
If endF<countPage Then reStr=reStr & DOT
reStr=reStr & "<span class=green> " & currentPage & "/" & countPage & " " & showTablePageSize & "/页</span> "
'显示上下页(当前页,总页数,前后加起来的页数,除去cp参数的GET串)
If queryStr="" Then
getStr="cp=1"
Else
getStr=queryStr & "&cp=1"
End If
If currentPage>1 Then
reStr=reStr & "<a href=""?" & getStr & """ target=_self class=page>首页</a> "
'*****************************************************
If queryStr="" Then
getStr="cp=1"
Else
getStr=queryStr & "&cp=1"
End If
If currentPage>1 Then
reStr=reStr & "<a href=""?" & getStr & """ target=_self class=page>首页</a> "
%>
<% Else
reStr=reStr & "<font color=#CCCCCC>首页</font> "
End If
'*****************************************************
If queryStr="" Then
getStr="cp=" & (currentPage-1)
Else
getStr=queryStr & "&cp=" & (currentPage-1)
End If
If currentPage>1 Then
reStr=reStr & "<a href=""?" & getStr & """ target=_self class=page>上页</a> "
Else
reStr=reStr & "<font color=#CCCCCC>上页</font> "
End If
'*****************************************************
If queryStr="" Then
getStr="cp=" & (currentPage+1)
Else
getStr=queryStr & "&cp=" & (currentPage+1)
End If
If currentPage<countPage Then
reStr=reStr & "<a href=""?" & getStr & """ target=_self class=page>下页</a> "
Else
reStr=reStr & "<font color=#CCCCCC>下页</font> "
End If
'*****************************************************
If queryStr="" Then
getStr="cp=" & countPage
Else
getStr=queryStr & "&cp=" & countPage
End If
If currentPage<countPage Then
reStr=reStr & "<a href=""?" & getStr & """ target=_self class=page>末页</a> "
Else
%>
<% reStr=reStr & "<font color=#CCCCCC>末页</font> "
End If
'*****************************************************
showPage=reStr
End Function%>
<%
Function allQueryString()
Dim queryTemp,queryT,query
queryTemp = Request.ServerVariables("QUERY_STRING")
If queryTemp <> "" Then
If Instr(queryTemp,"&")<>0 Then
queryTemp = Split(queryTemp,"&")
Dim queryI
For queryI = LBound(queryTemp) To UBound(queryTemp)
queryT = Split(queryTemp(queryI),"=")
If queryT(0)<>"cp" Then
query = query & queryTemp(queryI) & "&"
End If
Next
query = Left(query,Len(query)-1)
Else
queryTemp = Split(queryTemp,"=")
If queryTemp(0)<>"cp" Then
query = queryTemp(0) & "=" & queryTemp(1)
End If
End If
End If
allQueryString = query
End Function'过滤所有的GET串中的cp(当前页数据值),保留其它参数值
Function allQueryString()
Dim queryTemp,queryT,query
queryTemp = Request.ServerVariables("QUERY_STRING")
If queryTemp <> "" Then
If Instr(queryTemp,"&")<>0 Then
queryTemp = Split(queryTemp,"&")
Dim queryI
For queryI = LBound(queryTemp) To UBound(queryTemp)
queryT = Split(queryTemp(queryI),"=")
If queryT(0)<>"cp" Then
query = query & queryTemp(queryI) & "&"
End If
Next
query = Left(query,Len(query)-1)
Else
queryTemp = Split(queryTemp,"=")
If queryTemp(0)<>"cp" Then
query = queryTemp(0) & "=" & queryTemp(1)
End If
End If
End If
allQueryString = query
End Function%>%>
[code]<%
query = allQueryString()
Response.Write(showPage(showTableCurrentPage,showTableCountPage,9,query))'数据显示完毕后只需这两行代码即可,通用性还可以
query = allQueryString()
Response.Write(showPage(showTableCurrentPage,showTableCountPage,9,query))%>%>
可以非常方便的对付多条件过滤查询分布,至于被注入的话就不是我这个模板的事了
此模板只对于显出页数有效
PS:极力推荐用此模板