推薦:Asp文件操作函數集% '===============asp 文件操作函數集1.0版本========================= ' 整理作者: 張輝' 程序員代號:WJ008 ' 整理時間:2008年6 月1 日' 關注地址:www.wj008.net ' 所有函數使用的文件地址全部使用絕對地址'============================================
<%@ language = vbscript codepage = 936%>
<%
option explicit '強制定義變量
dim idcount'記錄總數
dim pages'每頁條數
dim pagec'總頁數
dim page'頁碼
dim pagenc '每頁顯示的分頁頁碼數量=pagenc*2+1
pagenc=2
dim pagenmax '每頁顯示的分頁的最大頁碼
dim pagenmin '每頁顯示的分頁的最小頁碼
page=clng(request(page))
dim start'程序開始的時間
dim endt'程序結束的時間
dim datafrom'數據表名
datafrom=table1
dim conn,rs
dim datapath '數據庫路經
dim sqlid'本頁需要用到的id
dim myself'本頁地址
myself = request.servervariables(path_info)
dim sql'sql語句
dim taxis'排序的語句
'taxis=order by id asc '正排序
taxis=order by id desc '倒排序
dim i'用於循環的整數
start=timer()
datapath=db.mdb'數據庫
pages=30
'連接打開數據庫
dim db
db=db.mdb '定義數據庫路徑及名稱
set conn = server.createobject(adodb.connection)
conn.open provider=microsoft.jet.oledb.4.0;data source= & server.mappath(db)
if err.number <> 0 then
response.write 數據庫鏈接出錯!
response.end()
end if
'獲取記錄總數
sql=select count(id) as idcount from [& datafrom &]
set rs=server.createobject(adodb.recordset)
rs.open sql,conn,0,1
idcount=rs(idcount)'獲取記錄總數
if(idcount>0) then'如果記錄總數=0,則不處理
if(idcount mod pages=0)then'如果記錄總數除以每頁條數有餘數,則=記錄總數/每頁條數+1
pagec=int(idcount/pages)'獲取總頁數
else
pagec=int(idcount/pages)+1'獲取總頁數
end if
'獲取本頁需要用到的id============================================
'讀取所有記錄的id數值,因為只有id所以速度很快
sql=select id from [& datafrom &] & taxis
set rs=server.createobject(adodb.recordset)
rs.open sql,conn,1,1
rs.pagesize = pages '每頁顯示記錄數
if page < 1 then page = 1
if page > pagec then page = pagec
if pagec > 0 then rs.absolutepage = page
for i=1 to rs.pagesize
if rs.eof then exit for
if(i=1)then
sqlid=rs(id)
else
sqlid=sqlid &,&rs(id)
end if
rs.movenext
next
'獲取本頁需要用到的id結束============================================
end if
%>
<!doctype html public -//w3c//dtd html 4.01 transitional//en>
<html>
<head>
<meta http-equiv=content-type content=text/html; charset=gb2312>
<title>快速分頁</title>
<link rel=stylesheet href=page.css type=text/css>
</head>
<body bgcolor=#f2f2f2 leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<table width=100% height=100% border=0 cellpadding=20 cellspacing=0>
<tr>
<td valign=middle><table width=100% height=100% border=0 cellpadding=0 cellspacing=1 bgcolor=#cccccc>
<tr>
<td valign=top bgcolor=#ffffff><br> <table width=90% border=0 align=center cellpadding=0 cellspacing=0 class=zw>
<tr>
<td><strong><font color=#ff6600>快速分頁</font></strong></td>
</tr>
</table>
<br>
<table width=90% border=0 align=center cellpadding=3 cellspacing=1 bgcolor=cccccc class=zw>
<tr align=center bgcolor=#9fcb07>
<td width=9%><strong>ID</strong></td>
<td width=37%><strong>主題</strong></td>
<td width=33%><strong>內容</strong></td>
<td width=21%><strong>時間</strong></td>
</tr>
<%
if(idcount>0 and sqlid<>) then'如果記錄總數=0,則不處理
'用in刷選本頁所語言的數據,僅讀取本頁所需的數據,所以速度快
sql=select [id],[aaaa],[bbbb],[cccc] from [& datafrom &] where id in(& sqlid &) &taxis
set rs=server.createobject(adodb.recordset)
rs.open sql,conn,0,1
while(not rs.eof)'填充數據到表格
%>
<tr bgcolor=#ffffff>
<td align=center><%=rs(0)%></td>
<td><%=rs(1)%></td>
<td><%=rs(2)%></td>
<td align=center><%=rs(3)%></td>
</tr>
<%
rs.movenext
wend
%>
</table>
<br>
<table width=90% border=0 align=center cellpadding=2 cellspacing=0 class=zw>
<tr align=center>
<td align=left>共有<strong><font color=#ff6600><%=idcount%></font></strong>條記錄,<strong><font color=#ff6600><%=page%></font></strong>/<%=pagec%>,每頁<strong><font color=#ff6600><%=pages%></font></strong>條。 </td>
</tr>
</table>
<table width=90% border=0 align=center cellpadding=2 cellspacing=0 class=zw>
<tr align=center>
<td align=right>
<%
'設置分頁頁碼開始===============================
pagenmin=page-pagenc'計算頁碼開始值
pagenmax=page+pagenc'計算頁碼結束值
if(pagenmin<1) then'如果頁碼開始值小於1則=1
pagenmin=1
end if
if(page>1) then'如果頁碼大於1則顯示(第一頁)
response.write (<a href='& myself &?page=1'><font color='#000000'>第一頁</font></a>)
end if
if(pagenmin>1) then'如果頁碼開始值大於1則顯示(更前)
response.write (<a href='& myself &?page=& page-(pagenc*2+1) &'><font color='#000000'>更前</font></a>)
end if
if(pagenmax>pagec) then'如果頁碼結束值大於總頁數,則=總頁數
pagenmax=pagec
end if
for i = pagenmin to pagenmax'循環輸出頁碼
if(i=page) then
response.write (<font color='#ff6600'><strong>& i &</strong></font>)
else
response.write ([<a href=& myself &?page=& i &><font color='#000000'>& i &</font></a>])
end if
next
if(pagenmax<pagec) then'如果頁碼結束值小於總頁數則顯示(更後)
response.write (<a href='& myself &?page=& page+(pagenc*2+1) &'><font color='#000000'>更後</font></a>)
end if
if(page<pagec) then'如果頁碼小於總頁數則顯示(最後頁)
response.write (<a href='& myself &?page=& pagec &'><font color='#000000'>最後頁</font></a>)
end if
'設置分頁頁碼結束===============================
%><script language=javascript>
<!--
function gopage() {
window.location.href=<%=myself%>?page=+ page.value;
}
//-->
</script>
轉到
<input name=page type=text value=<%=page%> size=5>頁
<input type=button name=submit value=跳轉></td>
</tr>
</table>
<%
end if
%>
<br>
<table width=90% border=0 align=center cellpadding=2 cellspacing=0 class=zw>
<tr>
<td align=center>
<p>
<%
endt=timer()
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
<%=formatnumber((endt-start)*1000,3)%>毫秒</p>
<p> <a href= http://stone-stone.vip.sina.com/ target=_blank>STONE空間</a></p></td>
</tr>
</table>
<br></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
分享:ASP使用FCKEditor的設置技巧1、默認語言打開fckconfig.js文件(相對FCKeditor文件夾,以下同),把自動檢測語言改為不檢測,把默認語言改為簡體中文: 程序代碼FCKConfig.AutoDetectLanguage = false ; FCKConfig.DefaultLanguage = 'zh-cn' ; 2、字體列表打開fckconfig.js文件,在字體列表中