》》》》》》》》》》》》》》》》》》》》》》---------------------------------- 在提交帖之后: % if Response.Cookies("time")>"" then if DateDiff('s',Response.Cookies("time"),now())20 '隔20s才能再發帖 Response.Write "script>alert('不能頻繁發帖');window.location=history.go(-1)/script>" response.End end if end if Response.Cookies("time")=now() …… '將帖子入庫 ----------------------------------------------------------
ASP項目中的公共翻頁模塊:
在大型的ASP項目中,很多的頁面都涉及到翻頁功能。如果每個頁面都寫一個翻頁的程序的話,這樣的工作即降低了工作效率,也不利于工程的模塊化,不能使代碼重用。因此,把翻頁這樣的功能模塊化是很有必要的。 設計方法: 1、調用該模塊時,只需要傳遞記錄集和每頁顯示的記錄的條數; 2、可以點擊鏈接進行翻頁,也可以直接輸入頁碼,回車后翻頁; 3、不要考慮文件名,程序的每次翻頁都能在當前頁面。 想清楚了上面3個問題,我們的公共翻頁模塊就可以動手了。 % '+++++++++++++++++++++++++++++++++++++ '◆模塊名稱: 公共翻頁模塊 '◆文 件 名: TurnPage.asp '◆傳入參數: Rs_tmp (記錄集), PageSize (每頁顯示的記錄條數) '◆輸 出: 記錄集翻頁顯示功能 '+++++++++++++++++++++++++++++++++++++ ' Sub TurnPage(ByRef Rs_tmp,PageSize) 'Rs_tmp 記錄集 PageSize 每頁顯示的記錄條數; Dim TotalPage '總頁數 Dim PageNo '當前顯示的是第幾頁 Dim RecordCount '總記錄條數 Rs_tmp.PageSize = PageSize RecordCount = Rs_tmp.RecordCount TotalPage = INT(RecordCount / PageSize * -1)*-1 PageNo = Request.QueryString ("PageNo") '直接輸入頁數跳轉; If Request.Form("PageNo")>"" Then PageNo = Request.Form("PageNo") '如果沒有選擇第幾頁,則默認顯示第一頁; If PageNo = "" then PageNo = 1 If RecordCount > 0 then Rs_tmp.AbsolutePage = PageNo End If
'獲取當前文件名,使得每次翻頁都在當前頁面進行; Dim fileName,postion fileName = Request.ServerVariables("script_name") postion = InstrRev(fileName,"/")+1 '取得當前的文件名稱,使翻頁的鏈接指向當前文件; fileName = Mid(fileName,postion) %> table border=0 width='100%'> tr> td align=left> 總頁數:font color=#ff3333>%=TotalPage%>/font>頁 當前第font color=#ff3333>%=PageNo%>/font>頁/td> td align="right"> %If RecordCount = 0 or TotalPage = 1 Then Response.Write "首頁|前頁|后頁|末頁" Else%> a href="%=fileName%>?PageNo=1">首頁|/a> %If PageNo - 1 = 0 Then Response.Write "前頁|" Else%> a href="%=fileName%>?PageNo=%=PageNo-1%>">前頁|/a> %End If
If PageNo+1 > TotalPage Then Response.Write "后頁|" Else%> a href="%=fileName%>?PageNo=%=PageNo+1%>">后頁|/a> %End If%>
table width=100%> tr> td>新聞編號/td> td>新聞標題/td> td>發布日期/td> tr> % If Not Rs_News.eof Do while Not Rs_News.eof and RowCount>0 %> tr> td>%=Rs_News("ID")%>/td> td>%=Rs_News("Name")%>/td> td>%=Rs_News("Date")%>/td> tr> % RowCount = RowCount - 1 Rs_News.MoveNext Loop End If %> (出處:www.dev-club.com)
-------------------------------------------------------------------- 在提交帖之后: % if Response.Cookies("time")>"" then if DateDiff('s',Response.Cookies("time"),now())20 '隔20s才能再發帖 Response.Write "script>alert('不能頻繁發帖');window.location=history.go(-1)/script>" response.End end if end if Response.Cookies("time")=now() …… '將帖子入庫
HTML XMLNS:IE> meta http-equiv="Content-Type" content="text/html; charset=gb2312"> IE:Download ID="include" STYLE="behavior:url(#default#download)" /> title>Chromeless Window/title>
SCRIPT LANGUAGE="JScript"> /*--- Special Thanks For andot ---*/
/* This following code are designed and writen by Windy_sk seasonx@163.net> You can use it freely, but u must held all the copyright items! */
/*--- Thanks For andot Again ---*/
var CW_width = 400; var CW_height = 300; var CW_top = 100; var CW_left = 100; var CW_url = "http://www.cnbruce.com/bluebook/"; var New_CW = window.createPopup(); var CW_Body = New_CW.document.body; var content = ""; var CSStext = "margin:1px;color:black; border:2px outset;border-style:expression(onmouseout=onmouseup=function(){this.style.borderStyle='outset'}, onmousedown=function(){if(event.button!=2)this.style.borderStyle='inset'});background-color:buttonface;width:16px;height:14px;font-size:12px;line-height:11px;cursor:Default;";
a{ color:blue; } body{ font-size:9pt; } /style> /head> body> script language="JavaScript"> !-- var layerTop=20; //菜單頂邊距 var layerLeft=30; //菜單左邊距 var layerWidth=140; //菜單總寬 var titleHeight=20; //標題欄高度 var contentHeight=200; //內容區高度 var stepNo=10; //移動步數,數值越大移動越慢
var itemNo=0;runtimes=0; document.write('span id=itemsLayer style="position:absolute;overflow:hidden;border:1px solid #efefef;left:'+layerLeft+';top:'+layerTop+';width:'+layerWidth+';">');
function moveUp(){ for(i=onItemIndex+1;i=toItemIndex;i++) eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)-contentHeight/stepNo;'); }
function moveDown(){ for(i=onItemIndex;i>toItemIndex;i--) eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)+contentHeight/stepNo;'); } changeItem(0); //--> /script> /body>