<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <% Response.buffer=false %> <!--#include file="./inc/conn.asp"--> <!--#include file="./inc/const.asp"--> <!--#include file="./inc/char.asp"--> <!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> <link href=./css/main.css rel=stylesheet> <script language=JavaScript> <!-- function DoEmpty(params) { if (confirm("真的要刪除這條記錄嗎?刪除後此記錄裏的全部內容都將被刪除而且沒法恢復!")) window.location = params ; } //--> </script> </head> <body> <br /> <table width="98%" cellspacing="1" cellpadding="3" bgcolor="#999999" align="center"> <tr bgcolor="#CCCCCC" align=center> <td colspan="5"><b>信息</b></td> </tr> <% dim pagecount,page,Spage,Epage,recordcount,i page = request.querystring("page") if page = "" or IsNull(page) then page = 1 if not IsNumeric(page) then page = 1 page = Cint(page) set rs = server.CreateObject ("Adodb.recordset") sql = "select * from goods order by id asc" rs.open sql,conn,1,1 recordcount = RS.RecordCount RS.PageSize = PAGESIZE pagecount = RS.PageCount if page < 1 then page = 1 elseif page > pagecount then page = pagecount end if if RS.EOF then%> <tr bgcolor="#ffffff" height=20> <td colspan="4" ><center><font color=#cc0000>目前尚未任何信息!</font><%if session("userkey")=4 then%> 請[<a href=add.asp?action=addmsg>點擊這裏</a>]發佈信息<%end if%></td> </tr></table> <%else%> <tr bgcolor="#ffffff" height=25><td colspan="4" ></tr> <%if recordcount > 0 then RS.AbsolutePage = page for i = 1 to PAGESIZE if RS.EOF then exit for%> <tr bgcolor="#dddddd"><td width=3%><center><img src=./img/folder.gif></td><td><b><%=rs("goods_id")%></b> (<%=rs("goods_name")%>)</td><td width=10%><center><font color=blue><%=rs("goods_price")%></font></td><td width=10%> |</td></tr> <% RS.MoveNext() next end if %> </table> <% if pagecount > 0 then response.write("<table width=""95%"" align=center cellspacing=3 cellpadding=3><tr><td align=right>") response.write("頁次:<font color=red><b>" & page & "</font>/" & pagecount & "</b> 每頁<b>" & pagesize & "</b> 共<b>" & recordcount & "</b>條留言 分頁:") Spage = page mod PARTSIZE if page > PARTSIZE then if Spage = 0 then Spage = PARTSIZE Spage = page - Spage + 1 else Spage = 1 end if Epage = Spage + PARTSIZE - 1 if Epage > pagecount then Epage = pagecount if page > PARTSIZE then response.write("<a href=""?page=" & Spage - 1 & """>[<<]</a>") end if for i = Spage to Epage if i = page then response.write("[<font color=red><b>" & i & "</b></font>]") else response.write("[<a href=""?page=" & i & """>" & i & "</a>]") end if next if Epage < pagecount then response.write("<a href=""?page=" & Epage + 1 & """>[>>]</a>") end if if Spage <> 1 then response.write("[<a href=""?page=1"">首頁</a>]") if Epage <> pagecount then response.write("[<a href=""?&page=" & pagecount & """>尾頁</a>]") response.write("</td></tr></table><br>") end if rs.close set rs=nothing%> <script type="text/javascript"> function openwindow(url,name,iWidth,iHeight) { var url; //轉向網頁的地址; var name; //網頁名稱,可爲空; var iWidth; //彈出窗口的寬度; var iHeight; //彈出窗口的高度; //window.screen.height得到屏幕的高,window.screen.width得到屏幕的寬 var iTop = (window.screen.height-30-iHeight)/2; //得到窗口的垂直位置; var iLeft = (window.screen.width-10-iWidth)/2; //得到窗口的水平位置; // window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no'); openWin(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no'); } /** * 監聽打開的彈窗,關閉後刷新頁面 */ function openWin(url,text,winInfo){ var winObj = window.open(url,text,winInfo); var loop = setInterval(function() { if(winObj.closed) { clearInterval(loop); //alert('closed'); parent.location.reload(); } }, 1); } </script> <hr align="center" width="90%" size="1"> <p align="center" class="style1"> Powered by wgscd</p> </body> </html>
const.asp: %> <% Const PAGESIZE=20 Const PARTSIZE=10 Const AboutSize=8 %> conn.asp: <% dim conn dim connstr dim db db="./data/goods.mdb" Set conn = Server.CreateObject("ADODB.Connection") connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db) conn.Open connstr %>