- 相關(guān)推薦
asp分頁代碼是什么
ASP即Active Server Pages,是MicroSOft公司開發(fā)的服務(wù)器端腳本環(huán)境,可用來創(chuàng)建動(dòng)態(tài)交互式網(wǎng)頁并建立強(qiáng)大的web應(yīng)用程序。下面就由yjbys小編給大家介紹ASP分頁代碼。
用這一句調(diào)用:
<%
call PageControl(iCount,maxpage,page,"border=0 align=right","<p align=center>",per_page)
%>
<%
Sub PageControl(iCount,pagecount,page,table_style,font_style,per_page)
'生成上一頁下一頁鏈接
Dim query, a, x, temp
action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")
temp=""
Response.Write("<table " & Table_style & ">" & vbCrLf )
Response.Write("<form method=get document.location = '" & action & "?zid="& zid & gro_page & "&" & temp & "Page='+ this.page.value;return false;""><TR>" & vbCrLf )
Response.Write("<TD align=right>" & vbCrLf )
Response.Write(font_style & vbCrLf )
if page<=1 then
Response.Write ("首頁 " & vbCrLf)
Response.Write ("上頁 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?zid="& zid & gro_page & "&" & temp & "Page=1>首頁</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?zid="& zid & gro_page & "&" & temp & "Page=" & (Page-1) & ">上頁</A> " & vbCrLf)
end if
if page>=pagecount then
Response.Write ("下頁 " & vbCrLf)
Response.Write ("尾頁 " & vbCrLf)
else
Response.Write("<A HREF=" & action & "?zid="& zid & gro_page & "&" & temp & "Page=" & (Page+1) & ">下頁</A> " & vbCrLf)
Response.Write("<A HREF=" & action & "?zid="& zid & gro_page & "&" & temp & "Page=" & pagecount & ">尾頁</A> " & vbCrLf)
end if
Response.Write(" 頁次:" & page & "/" & pageCount & "頁" & vbCrLf)
Response.Write(" 共有" & iCount & "條/每頁"&per_page&"條" & vbCrLf)
Response.Write(" 轉(zhuǎn)到" & "<INPUT TYEP=TEXT SIZE=4 Maxlength=8 VALUE=" & page & ">" & "頁" & vbCrLf & "<INPUT type=submit style=""font-size: 9pt"" value=GO )
Response.Write("</TD>" & vbCrLf )
Response.Write("</TR></form>" & vbCrLf )
Response.Write("</table>" & vbCrLf )
End Sub
%>
讀取數(shù)據(jù)庫代碼:
<%
if tab_recall_tga="1" then
o_zid=zid
zid=tab_recall_cd(0)
subt_where=" where newtype='"&tab_recall_cd(1)&"'"
end if
i=0
exec="select newsname,adddate,newsid,imgurl,summary from Mlist_"&zid&subt_where&" order by adddate desc"
set rs=server.CreateObject("adodb.recordset")
rs.open exec,conn,1,1
if rs.eof and rs.bof then
response.write "目前還沒有任何數(shù)據(jù)"
else
rs.PageSize =5 '每頁記錄條數(shù)
iCount=rs.RecordCount '記錄總數(shù)
iPageSize=rs.PageSize
maxpage=rs.PageCount
page=request("page")
per_page=rs.PageSize
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
For i=1 To x
if rs("newtype")=0 then
show_type=""
else
show_type=""
end if
uimg="0"
imgurl=trim(rs("imgurl"))
if len(imgurl)>0 then uimg="1"
if uimg<>"1" then imgurl="img/no.jpg"
%>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="140" valign="top">
<table width="162" height="90" border="0" cellpadding="0" cellspacing="1" bgcolor="C5C5C5">
<tr>
<td width="169" align="center" bgcolor="#FFFFFF"><img src="<%=imgurl%>" alt="<%=rs("newsname")%>" width="174" height="91" border="0"></td>
</tr>
</table></td>
<td height="70" valign="top">
<table width="97%" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td width="88%" height="25"><strong><font color="#000000"><%=rs("newsname")%></font></strong> 發(fā)布時(shí)間:<%=rs("adddate")%></td>
<td> </td>
</tr>
<tr>
<td height="65" valign="top"><%=rs("summary")%></td>
<td width="12%" align="right" valign="bottom"><a href="m_news.asp?zid=<%=zid%>&id=<%=rs("newsid")%>">詳細(xì)>></a></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" valign="top"><hr size="1" noshade></td>
</tr>
</table>
<% RS.MoveNext
next
end if
rs.close
set rs=nothing
if tab_recall_tga="1" then zid=o_zid '重新恢復(fù)虛擬定向表
%>
插入代碼:
exec="insert into Admin(user_id,user_pwd,lev)values('"&o_user_id&"','"&o_user_pwd&"','"&o_lev&"')"
'response.write exec
conn.execute exec
conn.close
set conn=nothing
更新代碼:
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
【asp分頁代碼是什么】相關(guān)文章:
asp緩存類代碼09-28
asp獲取當(dāng)前URL代碼實(shí)例10-14
關(guān)于ASP模板類代碼參考08-29
asp.net 組合模式的PHP代碼10-07
HTML代碼是什么05-10
防盜鏈接ASP函數(shù)實(shí)現(xiàn)代碼08-03
asp.net動(dòng)態(tài)獲取Excel表名的代碼10-12