》》》》》》》》》》》》》》》》》》》》》》---------------------------------- 在提交帖之后: % 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>