函数
<%
function showPageTurn(url,c_page,t_page)
dim theUrl
dim beginpage
dim endpage
theUrl=url
if instr(theUrl,"?")>0 then
theUrl=theUrl&"&"
else
theUrl=theUrl&"?"
end if
response.write "<table border='0' cellpadding='0' cellspacing='0'>" & vbcrlf
response.write "<tr>" & vbcrlf
response.write "<td>共有 <span class='red'><strong>" & t_record & "</strong></span> 条记录,共有 " & t_page & " 页:</td>" & vbcrlf
response.write "<td><table border='0' cellpadding='0' cellspacing='1'>" & vbcrlf
response.write "<tr>" & vbcrlf
if c_page-5>1 then
response.write "<td class='tbp2' width='20'><a href='" & theUrl & "page=1'><<</a></td>" & vbcrlf
end if
if c_page>1 then
response.write "<td class='tbp2' width='20'><a href='" & theUrl & "page=" & c_page-1 & "'><</a></td>" & vbcrlf
end if
beginPage=c_page-5
if beginPage<=0 then
beginPage=1
end if
endPage=c_page+5
if endPage>t_page then
endPage=t_page
end if
while beginPage<=endPage
if beginPage=c_page then
response.write "<td class='tbp2' width='20'><font color='red'>" & beginPage & "</font></td>" & vbcrlf
else
response.write "<td class='tbp2' width='20'><a href='" & theUrl & "page=" & beginPage & "'>" & beginPage & "</a></td>" & vbcrlf
end if
beginPage=beginPage+1
wend
if c_page<t_page then
response.write "<td class='tbp2' width='20'><a href='" & theUrl & "page=" & c_page+1 & "'>></a></td>" & vbcrlf
end if
if c_page+5<t_page then
response.write "<td class='tbp2' width='20'><a href='" & theUrl & "page=" & t_page & "'>>></a></td>" & vbcrlf
end if
response.write "</tr>" & vbcrlf
response.write "</table></td>" & vbcrlf
response.write "</tr>" & vbcrlf
response.write "</table>" & vbcrlf
end function
%>
调用例子:
<%@ Language=VBScript %>
<%Response.Buffer=true%>
<%Response.Expires=0%>
<!--#include file="../../../Connections/conn.asp"-->
<!--#include file="../../../include/swapstr.asp"-->
<!--#include file="../../../include/utility.asp"-->
<!--#include file="../../checklogin.asp"-->
<%
if CheckManagerRight(10,cstr(session("adminuser_id"))) = false then
Response.Redirect "../../righterror.asp"
end if
%>
<html>
<head>
<title>赛事查询</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../../adminmanage.css" type="text/css">
</head>
<body>
<!--#include file="../../../include/chkpost.asp"-->
<%
ok=request.form("ok")
if ok="确定" then
session("list_gametypes")=trim(request.form("types"))
session("list_gamecname")=trim(request.form("cname"))
session("list_gameename")=trim(request.form("ename"))
end if
if session("list_gametypes")<>"" then
sql_where=sql_where & " and Type = '" & SQLStr(session("list_gametypes")) & "'"
end if
if session("list_gamecname")<>"" then
sql_where=sql_where & " and CName like '%" & SQLStr(session("list_gamecname")) & "%'"
end if
if session("list_gameename")<>"" then
sql_where=sql_where & " and Ename like '%" & SQLStr(session("list_gameename")) & "%'"
end if
Set rs_games = Server.CreateObject("ADODB.Recordset")
rs_games.ActiveConnection = MM_conn_STRING
rs_games.Source="select top 90 GamesID,EName,CName,EndDate,Season,type from Games_Info where 1=1" & sql_where & " order by cname,season"
'response.write rs_games.Source
rs_games.CursorType = 1
rs_games.LockType = 1
rs_games.Open()
page=request.querystring("page")
if page="" or not isnumeric(page) then
c_page=1
elseif page<=0 then
c_page=1
else
c_page=clng(left(page,9))
end if
pagesize=30
rs_games.PageSize=pageSize
t_page=rs_games.PageCount
t_record=rs_games.recordcount
pageUrl="games_list.asp" //这个代码的页面
%>
<div align="center">
<form method="post" name="forms" action="games_list.asp">
<br>
<b class="font14px">赛事查询</b>
<input type="submit" name="ok" value="确定" class = "b1">
<br>
<br>
<table width="70%" border="1" align="center" cellpadding="2" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#FF9900">
<tr>
<td width="30%" bgcolor="#FFCC99" align="right">[赛事类型]</td>
<td>
<select name="types">
<option value="">不限</option>
<option value="1" <%if cstr(session("list_gametypes"))="1" then response.write "selected"%>>各国联赛</option>
<option value="2" <%if cstr(session("list_gametypes"))="2" then response.write "selected"%>>世界杯决赛</option>
<option value="3" <%if cstr(session("list_gametypes"))="3" then response.write "selected"%>>洲际杯</option>
<option value="4" <%if cstr(session("list_gametypes"))="4" then response.write "selected"%>>世界杯预选赛</option>
<option value="5" <%if cstr(session("list_gametypes"))="5" then response.write "selected"%>>各大洲国家杯决赛</option>
<option value="6" <%if cstr(session("list_gametypes"))="6" then response.write "selected"%>>各大洲国家杯预选赛</option>
<option value="7" <%if cstr(session("list_gametypes"))="7" then response.write "selected"%>>友谊赛</option>
<option value="8" <%if cstr(session("list_gametypes"))="8" then response.write "selected"%>>其他</option>
<option value="9" <%if cstr(session("list_gametypes"))="9" then response.write "selected"%>>NBA</option>
<option value="10" <%if cstr(session("list_gametypes"))="10" then response.write "selected"%>>特别投注能过关</option>
<option value="11" <%if cstr(session("list_gametypes"))="11" then response.write "selected"%>>特别投注不能过关</option>
</select>
</td>
</tr>
<tr>
<td bgcolor="#FFCC99" align="right">[赛事中文名]</td>
<td><input type="text" name="cname" value="<%=session("list_gamecname")%>" class = "t1">(模糊)</td>
</tr>
<tr>
<td bgcolor="#FFCC99" align="right">[赛事英文名]</td>
<td><input type="text" name="ename" value="<%=session("list_gameename")%>" class = "t1">(模糊)</td>
</tr>
</table>
</form>
</div>
<table width="98%" border="1" align="center" cellpadding="1" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#FF9900">
<tr align="center">
<td width="8%" height="25" bgcolor="#FFCC99">[赛事ID]</td>
<td width="24%" height="25" bgcolor="#FFCC99">[赛事英文名]</td>
<td width="11%" height="25" bgcolor="#FFCC99">[赛事中文名]</td>
<td width="11%" height="25" bgcolor="#FFCC99">[赛季/届数]</td>
<td width="19%" height="25" bgcolor="#FFCC99">[赛事类型]</td>
<td width="10%" height="25" bgcolor="#FFCC99">[结束日期]</td>
<td width="6%" height="25" bgcolor="#FFCC99">[修改]</td>
</tr>
<%
if not rs_games.eof then
if c_page>t_page then
c_page=t_page
end if
rs_games.AbsolutePage=c_page
dim record_i
record_i=0
while not rs_games.eof and record_i<pagesize
if rs_games("type")=1 then
kind="各国联赛"
elseif rs_games("type")=2 then
kind="世界杯决赛"
elseif rs_games("type")=3 then
kind="洲际杯"
elseif rs_games("type")=4 then
kind="世界杯预选赛"
elseif rs_games("type")=5 then
kind="各大洲国家杯决赛"
elseif rs_games("type")=6 then
kind="各大洲国家杯预选赛"
elseif rs_games("type")=7 then
kind="友谊赛"
elseif rs_games("type")=8 then
kind="其他"
elseif rs_games("type")=9 then
kind="NBA"
end if
%>
<tr align="center">
<td width="8%"> <%=rs_games("GamesID")%></td>
<td width="24%"> <%=rs_games("EName")%></td>
<td width="11%"> <%=rs_games("CName")%></td>
<td width="11%"> <%=rs_games("Season")%></td>
<td width="19%"> <%=kind%></td>
<td width="10%"> <%=rs_games("EndDate")%></td>
<td width="6%">
<input type='button' value='修改' class = 't1' onClick="document.location.href='games_modify.asp?gamesid=<%= rs_games("GamesID")%>'"></td>
</tr>
<%
rs_games.movenext
record_i=record_i+1
Wend
end if
%>
<tr align="center">
<td colspan="7">
<%showPageTurn pageurl,c_page,t_page%> </td>
</tr>
</table>
</body>
</html>
<%
set rs_games=nothing
set MM_conn_STRING=nothing
%>