技术记录
这里是call
'++++++++++++++++++++++ '新闻必备 'RsSql(Sql) '++++++++++++++++++++++ Function RsSql(Sql) Set Rs=Conn.Execute(Sql) IF Not Rs.Eof Then RsSql = Rs.GetRows() Else Response.Write("") End IF Rs.Close() Set Rs = Nothing End Function
'++++++++++++++++++++++ '翻页 'Fenye(FenUrl,pagestr) '++++++++++++++++++++++ Sub Fenye(FenUrl,pagestr) response.Write("<div class=""digg"">") response.Write("<a href="""&FenUrl&"?Page=1"&pagestr&""">首页</a>") if page <=1 then response.Write("<span class=""disabled"">上一页</span>") else response.Write("<a href="""&FenUrl&"?Page="&(page-1)&""&pagestr&""">上一页</a>") end if if page<=page then for c=4 to 1 step -1 if (page-c)>0 then response.Write("<a href="""&FenUrl&"?Page="&(page-c)&""&pagestr&""">"&(page-c)&"</a>") end if next end if response.Write("<span class=""current"">"&page&"</span>") if page<rs.pagecount then for d=1 to 4 if (page+d)<=rs.pagecount then response.Write("<a href="""&FenUrl&"?Page="&(page+d)&""&pagestr&""">"&(page+d)&"</a>") end if next end if if rs.pagecount - page < 1 then response.Write("<span class=""disabled"">下一页</span>") else response.Write("<a href="""&FenUrl&"?Page="&(page+1)&""&pagestr&""">下一页</a>") end if response.Write("<a href="""&FenUrl&"?Page="&rs.pagecount&""&pagestr&""">尾页</a>") response.Write("<a>"&page&"/"&rs.pagecount&"页</a>") response.Write("</div>") End Sub
这里是调用
<% Rc=RsSql("sql语句") if isarray(Rc) then for p=0 to ubound(Rc,2) %> <%=Rc(0,p)%> 这是ID <% next end if %> <% Set Rs=Server.Createobject("Adodb.Recordset") Sql="sql语句" Rs.open sql,conn,1,1 Rs.pagesize=20 IF Rs.Recordcount>0 Then page=clng(Request("page")) if page<1 then page=1 if page>rs.pagecount then page=rs.pagecount rs.absolutepage=page For i=1 to Rs.pagesize %> <%=Rs("id")%> <% Rs.MoveNext if rs.eof then exit for next end if
if rs.recordcount>rs.pagesize then call Fenye("N.asp","&id="&id) end if Rs.Close Set Rs=notHing Sql=""
%>
翻页的样式css
/*页码*/ .digg {TEXT-ALIGN: center; height:40px; padding-top:10px;} .digg A {COLOR: #333;BORDER: #C1C1C1 1px solid; TEXT-DECORATION: none; padding:6px 14px; background:url(../Images/ding.jpg) repeat-x;margin:3px;} .digg A:hover {BORDER: #00A8FF 1px solid;COLOR: #000;background:url(../Images/ding.jpg) repeat-x; text-decoration:none;} .digg A:active {COLOR: #000; BORDER: #C1C1C1 1px solid;background:url(../Images/ding.jpg) repeat-x;} .digg SPAN.current {BORDER: #00A8FF 1px solid; FONT-WEIGHT: bold; COLOR: #fff;BACKGROUND-COLOR:#00A8FF;padding:6px 14px;margin:3px;} .digg SPAN.disabled {BORDER: #eee 1px solid;PADDING:6px 14px;COLOR: #CCC;margin:3px;background:url(../Images/ding.jpg) repeat-
此处有图片右键另存