求分页代码,谁能帮我加进去?(附源代码)

jeesir 2007-12-11 09:30:08
a.asp如下:
<%
sname=request.form("aa")
response.Write sname
if sname=""then
response.write "<script language=JavaScript>" & chr(13) & "alert('请输入你要查询的条件');" & "history.back()" & "</script>"
Response.End
end if
%>

<!--#include file="conn.asp"-->
<%
sqlstr="select * from [cs] where [name] like '%"& sname &"%'or sdhbh like '%"& sname &"%' or ddf like '%"& sname &"%' or name2 like '%"& sname &"%' or ywbh like '%"& sname &"%'"
set rs=server.createobject("adodb.recordset")
rs.open sqlstr,conn,1,1
%>

<%
if rs.EOF and rs.BOF then
Response.Write "<br>没有查询到相关数据"
else
%>

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>
<table width="768" border="0" cellpadding="5" cellspacing="1" bgcolor="#00929C">
<tr bgcolor="#f4f4f4">
<td width="10%" align="center" height="25">属性</td>
<td width="12%" align="center" height="25">名称</td>
<td width="12%" align="center" height="25">编号</td>
<td width="12%" align="center" height="25">DDF</td>
<td width="12%" align="center" height="25">对端</td>
<td width="12%" align="center" height="25">编号2</td>
<td width="12%" align="center" height="25">备注</td>
<td width="12%" align="center" height="25">操作</td>
</tr>
<%
do while not rs.eof
%>


<tr bgcolor="#FFFFFF">
<td width="10%"><%=rs("dlsx")%></td>
<td width="12%"><%=rs("name")%></td>
<td width="12%"><%=rs("sdhbh")%></td>
<td width="12%"><%=rs("ddf")%></td>
<td width="12%"><%=rs("name2")%></td>
<td width="12%"><%=rs("ywbh")%></td>
<td width="12%"><%=rs("bz")%></td>
<td width="12%">
<a href="m.asp?id= <%=rs("id")%> ">修改</a>
</tr>
<%
rs.movenext
loop
end if
rs.Close
set rs=nothing
set conn=nothing
%>
</table></td>
</tr>
</table>


求分页代码,谁能帮我加进去?
...全文
50 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
jeesir 2007-12-12
  • 打赏
  • 举报
回复
我不是很懂谁能帮加进去呢?
braveboy 2007-12-11
  • 打赏
  • 举报
回复
'**************************************************
'函数名:ShowPageDiv
'作 用:显示“上一页 下一页”等信息
'参 数:sFileName ----链接地址
' TotalNumber ----总数量
' MaxPerPage ----每页数量
' CurrentPage ----当前页
' ShowTotal ----是否显示总数量
' ShowAllPages ---是否用下拉列表显示所有页面以供跳转。
' strUnit ----计数单位
' ShowMaxPerPage ----是否显示每页信息量选项框
' divcss ---- div 样式表
' urlcss ---- URL样式表
'返回值:“上一页 下一页”等信息的HTML代码
'**************************************************
Function ShowPageDiv(sfilename, totalnumber, MaxPerPage, CurrentPage, ShowTotal, ShowAllPages, strUnit, ShowMaxPerPage,divcss,urlcss)
Dim TotalPage, strTemp, strUrl, i
'order=request("order")
If totalnumber = 0 Or MaxPerPage = 0 Or IsNull(MaxPerPage) Then
ShowPageDiv = ""
Exit Function
End If
If totalnumber Mod MaxPerPage = 0 Then
TotalPage = totalnumber \ MaxPerPage
Else
TotalPage = totalnumber \ MaxPerPage + 1
End If
If CurrentPage > TotalPage Then CurrentPage = TotalPage

strTemp = "<div class='"& divcss &"'>"
If ShowTotal = True Then
strTemp = strTemp & "共 <b>" & totalnumber & "</b> " & strUnit & "  "
End If
If ShowMaxPerPage = True Then
strUrl = JoinChar(sfilename) & "MaxPerPage=" & MaxPerPage & "&"
Else
strUrl = JoinChar(sfilename)
End If
If CurrentPage = 1 Then
strTemp = strTemp & "首页 上一页 "
Else
strTemp = strTemp & "<a href='" & strUrl & "page=1' class = '"& urlcss &"'>首页</a> "
strTemp = strTemp & "<a href='" & strUrl & "page=" & (CurrentPage - 1) & "' class = '"& urlcss &"'>上一页</a> "
End If

If CurrentPage >= TotalPage Then
strTemp = strTemp & "下一页 尾页"
Else
strTemp = strTemp & "<a href='" & strUrl & "page=" & (CurrentPage + 1) & "' class = '"& urlcss &"'>下一页</a> "
strTemp = strTemp & "<a href='" & strUrl & "page=" & TotalPage & "' class = '"& urlcss &"'>尾页</a>"
End If
strTemp = strTemp & " 页次:<strong><font color=red>" & CurrentPage & "</font>/" & TotalPage & "</strong>页 "
If ShowMaxPerPage = True Then
strTemp = strTemp & " <input type='text' name='MaxPerPage' size='3' maxlength='4' value='" & MaxPerPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & JoinChar(sfilename) & "page=" & CurrentPage & "&MaxPerPage=" & "'+this.value;"">" & strUnit & "/页"
Else
strTemp = strTemp & " <b>" & MaxPerPage & "</b>" & strUnit & "/页"
End If
If ShowAllPages = True Then
If TotalPage > 20 Then
strTemp = strTemp & "  转到第<input type='text' name='page' size='3' maxlength='5' value='" & CurrentPage & "' onKeyPress=""if (event.keyCode==13) window.location='" & strUrl & "page=" & "'+this.value;"">页"
Else
strTemp = strTemp & " 转到:<select name='page' size='1' onchange=""javascript:window.location='" & strUrl & "page=" & "'+this.options[this.selectedIndex].value;"">"
For i = 1 To TotalPage
strTemp = strTemp & "<option value='" & i & "'"
If PE_CLng(CurrentPage) = PE_CLng(i) Then strTemp = strTemp & " selected "
strTemp = strTemp & ">第" & i & "页</option>"
Next
strTemp = strTemp & "</select>"
End If
End If
strTemp = strTemp & "</div>"
ShowPageDiv = strTemp
End Function

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧