當前位置:首頁 » 操作系統 » 分頁樣式源碼

分頁樣式源碼

發布時間: 2023-04-22 10:13:37

① Thinkphp分頁樣式CSS代碼

新建一個thinkphp項目tp,入口文件如下:

2
資料庫think下新建表qq_game,結構如下:

3
新建一個控制器AdminAction.class.php,位置如圖所示:

4
在此控制器下新建函數beauty_page,用於美化分頁;
未設置自定義分頁時,函數如圖:

模板頁:tp/App/Tpl/Admin/beauty_page.html , 內容如圖:

分頁結果如下:

thinkphp中通過分頁類Page提供的方法setConfig,來修改分頁的設置:
比如:在代碼 $pg = new Page($count, $per_page); 後插入下面的分頁設置代碼:

此時,分頁顯示冊搏察結果如下(其中的上一頁、下一頁被改變):

Page類提供的setConfig方法,還可以設置theme 作為分頁主題描述信息。
設置該屬性可以改變分頁的各個單元的顯示銀拍位置,默認值是:
"%totalRow% %header% %nowPage%/%totalPage% 頁 %upPage% %downPage% %first% %prePage% %linkPage% %nextPage% %end%"
可以通過改變該值的樣式改變分頁的樣式。
比如:在列表頁添加樣式:如下:

結果顯示如下:

也可以給記錄總數添加樣式,如圖,給當前記錄數,添加樣式:

在模板州茄頁添加樣式,如圖:

結果顯示:

總結:可根據自己的愛好,自行添加樣式,其中.pages a , .pages .current 是自帶的,最好不要修改名稱,可修改樣式;如果不滿意,可參考第11步,自行修改。

② 求asp分頁代碼,請給編劇一下下面的源碼

已經完全給你寫好了,請直接復制下面代碼進行使用做橘謹(注純基意,我的程序中所有的news.asp都要換成你的文件的文件名。如果你本頁的文件名就叫news.asp的話就不用換啦)

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("db_sousuo1.mdb")
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>無標題文檔</title>
<伍信/head>
<body>
<table width="535" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="200" valign="top">
<%
dim rs,sql
set rs=server.CreateObject("adodb.recordset")

sql="select * from proct where "

if trim(request("bt"))<>"" then
sql= sql & "carclass like '%"&trim(request("bt"))&"%' and "
end if

if trim(request("nr"))<>"" then
sql= sql & "provice like '%"&trim(request("nr"))&"%' and "
end if

if trim(request("fbz"))<>"" then
sql= sql & "provice_shi like '%"&trim(request("fbz"))&"%' and "
end if
sql= sql & " 1=1 "
rs.open sql,conn,1
if rs.bof or rs.eof then
response.write "對不起,沒有符合查詢條件的學生信息!"
else
dim page
page=Clng(request("page"))
rs.pagesize=20
if page<1 then page=1
if page>rs.pagecount then page=rs.pagecount
rs.Absolutepage=page
%>
<%
for i=1 to rs.pagesize
%>
<table height=24 cellspacing=0 cellpadding=0 width=535 border=0>
<tbody>
<tr bgcolor="#f7f7f7" onmouseover="this.bgColor='#e8e8e8';" onmouseout="this.bgColor='#f7f7f7';">
<td height="25" align="left"><%=i%>. <%=rs("carclass")%></td>
</tr>
</tbody>
</table>
<%
rs.movenext
if rs.eof then exit for
next
end if
%></td>
</tr>
<tr>
<td>
<form name="form1" method="get" action="news.asp">
<%
Response.write "<span class='style1'>共找到</span>" & "<span class='style1'><font color='#FF0000'>" & Cstr(rs.RecordCount) & "</font></span>" & "<span class='style1'>名學生</span>  "
if page<>1 then
response.write "<span class='style1'><a href=news.asp?page=1>首頁</a> </span>"
response.write "<span class='style1'><a href=news.asp?page="&(page-1)&">上一頁</a></span> "
end if
if page<>rs.pagecount then
response.write "<span class='style1'><a href=news.asp?page="&(page+1)&">下一頁</a> </span>"
response.write "<span class='style1'><a href=news.asp?page="&rs.pagecount&">尾頁</a> </span>"
end if
%>
<span class='style1'>第<font color='#FF0000'><%=page%></font>頁/共<font color='#FF0000'><%=rs.pagecount%></font>頁  </span>
<input name="page" size="2" value="<%=page%>">
<INPUT id=image type=image src="images/go.gif" border=0>
</form>
</td>
</tr>
</table>

</body>
</html>

③ 如何解釋asp分頁提示的源代碼

拜託,這是ASP.NET的代碼。
可以先取一個記錄集對象,再CONST一個每頁顯示數的變數MaxPerPage,然後再RS.MOVE MaxPerPage。然後再顯示就行了。
注意一下傳的頁面的值,另外優化的時候也可以將select語句變成select top MaxPerPage,這樣就節省伺服器資源哦。不用的欄位也不用顯示,所用的欄位返回就行了掘桐,代替*。
我可以給你一個ASP的分頁代碼,自己參照著ASP.NET改一下就可以用了。
<!--#include file="../kill/chkssn.asp" -->
<!--#include file="../kill/chkadm.asp" -->
<!--#include file="../pub/connec.asp" -->
<%
Dim Page,RSNum,Total,MaxPerPage,FileName

Page=Request.QueryString("page") '取頁數
MaxPerPage=10
FileName="hits.asp"

Set RS = Server.CreateObject("ADODB.RecordSet") '打開資料庫
SQLStr = "Select * from user_info order by u_hits desc"
RS.Open SQLStr,Conn,1,1

If RS.BOF AND RS.EOF Then
Response.Write("無數據")
RS.Close
Conn.Close
Response.End()
End If

RSNum=RS.RecordCount
RS.PageSize=MaxPerPage

If (RSNum mod MaxPerPage)=0 Then '判斷總頁數
Total=RSNum\MaxPerPage
Else
Total=RSNum\MaxPerPage+1
End If

If IsNumeric(Page) and Len(Page)>0 Then '判斷是否為數字
Page=Int(Page)
Else
Page=1
End If

If Page>胡首Total or Page<1 Then '頁數偵錯
Page=1
End If

If Page=1 Then '設置RS第一條記錄的位置
RS.MoveFirst
Else
RS.Move (Page-1)*MaxPerPage
End If
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href="../img/admin.css" rel="stylesheet"褲散數 type="text/css" />
</head>
<body bgcolor="#CCCCCC">
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" id="images_add">
<tr>
<td height="35"></td>
</tr>
<tr>
<td height="77" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th height="39" align="center">導師點擊量統計</th>
</tr>
<tr>
<td height="204" align="left" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<th width="70" align="center" bgcolor="#CCCCCC">ID</th>
<th width="70" align="center" bgcolor="#CCCCCC">登錄名</th>
<th width="70" height="30" align="center" bgcolor="#CCCCCC">真實姓名</th>
<th width="100" align="center" bgcolor="#CCCCCC">類別</th>
<th align="center" bgcolor="#CCCCCC">學科</th>
<th width="70" align="center" bgcolor="#CCCCCC">點擊數</th>
<th width="70" align="center" bgcolor="#CCCCCC">修改人</th>
<th width="100" align="center" bgcolor="#CCCCCC">修改時間</th>
</tr>
<%
If not(RS.BOF and RS.EOF) Then
For i=1 To MaxPerPage
If RS.EOF Then Exit For
%>
<tr>
<td align="center" bgcolor="#CCCCCC"><%= RS("u_id") %></td>
<td align="center" bgcolor="#CCCCCC"><%= RS("u_login_name") %></td>
<td height="30" align="center" bgcolor="#CCCCCC"><a href="../users/teachers_edit.asp?id=<%= RS("u_id") %>"><%= RS("u_real_name") %></a></td>
<td height="30" align="center" bgcolor="#CCCCCC"><a href="../users/teachers_edit.asp?id=<%= RS("u_id") %>">
<% If RS("u_doctor")=True and RS("u_graate")=True Then %>
博碩雙導師
<%
Else
If RS("u_doctor")=True Then
%>
博士生導師
<% End If %>
<% If RS("u_graate")=True Then %>
碩士生導師
<% End If %>
<% End If %>
</a></td>
<td height="30" align="center" bgcolor="#CCCCCC"><a href="../users/teachers_edit.asp?id=<%= RS("u_id") %>"><%= Left(RS("u_teach_major"),25) %></a></td>
<td align="center" bgcolor="#CCCCCC"><%= RS("u_hits") %></td>
<td align="center" bgcolor="#CCCCCC"><%= RS("u_edit_user") %></td>
<td align="center" bgcolor="#CCCCCC"><%= RS("u_edit_date") %></td>
</tr>
<%
RS.MoveNext
Next
End If
%>
<tr>
<td height="30" colspan="8" align="center" bgcolor="#CCCCCC"><%
If Page=1 and Total=1 Then '只有一頁
%>
首頁上一頁下一頁尾頁第1/1頁共<%= RSNum %>條記錄
<%
End If

If Page=1 and Total>1 Then '首頁
%>
首頁上一頁<a href="<%= FileName %>?page=<%= Page+1 %>">下一頁</a><a href="<%= FileName %>?page=<%= Total %>">尾頁</a>第<%= Page %>/<%= Total %>頁共<%= RSNum %>條記錄
<%
End If

If Page>1 and Total>1 and Page<>Total Then '中間頁
%>
<a href="<%= FileName %>?page=1">首頁</a><a href="<%= FileName %>?page=<%= Page-1 %>">上一頁</a><a href="<%= FileName %>?page=<%= Page+1 %>">下一頁</a><a href="<%= FileName %>?page=<%= Total %>">尾頁</a>第<%= Page %>/<%= Total %>頁共<%= RSNum %>條記錄
<%
End If

If Page>1 and Page=Total Then '最後一頁
%>
<a href="<%= FileName %>?page=1">首頁</a><a href="<%= FileName %>?page=<%= Page-1 %>">上一頁</a>下一頁尾頁第<%= Page %>/<%= Total %>頁共<%= RSNum %>條記錄
<%
End If
%>
</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="71"></td>
</tr>
</table>
</body>
</html>
<%
RS.Close
Conn.Close
%>

④ 求asp分頁源代碼

暈~~ 你不是吧
我給你悶攔寫個吧
<%
rs.pagesize=3
pagecount=rs.pagecount
page=int(request.querystring("page"))
if page<1 then page=1
if request.querystring("page")="" then page=1
rs.absoultepage=page
%>
下面是用for實現每頁的條數
<%
for i=1 to rs.pagesize
if rs.eof then exit for
%>
-----顯示內容---
<%
rs.movenext
next
%>
<%
for i=1 to pagecount '這里就是1 2 3 4 5 6 7 8 9 10
你自己把不同的巧薯i的值加鏈孝罩者接就可以了
下一頁就是page+1
上一頁就是page-1
自己寫完吧
%>

熱點內容
ueditor的圖片上傳 發布:2025-07-04 06:09:09 瀏覽:538
iis7匿名訪問 發布:2025-07-04 05:53:33 瀏覽:317
ftp伺服器被動模式配置 發布:2025-07-04 05:17:32 瀏覽:334
電動車小龜有哪些配置 發布:2025-07-04 05:16:18 瀏覽:42
mysql同步存儲過程 發布:2025-07-04 05:14:32 瀏覽:665
安卓手機如何控制空調 發布:2025-07-04 05:09:06 瀏覽:157
新潔爾滅用於物體表面怎麼配置 發布:2025-07-04 05:03:28 瀏覽:832
生活中的雲伺服器 發布:2025-07-04 05:01:55 瀏覽:747
三星g6700c原始密碼是多少 發布:2025-07-04 04:49:41 瀏覽:728
網頁編程代碼 發布:2025-07-04 04:47:25 瀏覽:806