我們儲存在資料庫中的內容是HTML格式的,但是有時候我們需要無格式的顯示這內容,這是用Regex實現的過濾。複製代碼 代碼如下:<% function nohtml(str) dim re Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern="(\<.[^\<]*\>)" str=re.replace(str," ")
複製代碼 代碼如下:防止一般的採集以及小偷讀取,加在頂部。同理,可以改造成JS指令碼。<% Dim AppealNum,AppealCount AppealNum=10 '同一IP60秒內要求節流10次 AppealCount=Request.Cookies("AppealCount") If AppealCount="" Then response.Cookies("AppealCount")=1 AppealCount=1
<html> <head> <title>無標題文檔</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <script language="javascript"> var curRow=null; var y=1; function selectRow(){ var e=window.event; var
複製代碼 代碼如下:<!-- //ASP分頁函數 function ShowListPage(page,Pcount,TopicNum,maxperpage,strLink,ListName){ var alertcolor = '#FF0000'; maxperpage=Math.floor(maxperpage); TopicNum=Math.floor(TopicNum); page=Math.floor(page); var n,p;
在本篇檔案中,我們將討論編程人員在使用ASP.NET開發應用程式時需要注意的10個技巧,這些技巧涉及從預設的控制項、表單名的改變到StringBuilder類的使用,有助於編程人員能夠儘快地適應.NET環境。 1、在使用Visual Studio .NET時,除直接或非引用的對象外,不要使用預設的名字。 .NET帶來的好處之一是所有的原始碼和設定檔都是純文字檔案,能夠使用Notepad或WordPad等任意的文字編輯器進行編輯。如果不願意,我們並非一定要使用Visual Studio
Rem ## 長整數轉換 Function toNum(s, default) If IsNumeric(s) and s <> "" then toNum = CLng(s) Else toNum = default End If End Function Rem ## SQL 陳述式轉換 Function toSql(str) If IsNull(str) Then str = "" toSql = replace(str, "''", "''''")
1、純粹的截取字串複製代碼 代碼如下:function cutstr(thestr1,strlen) dim l,t,c l=len(thestr1) if l<1 then exit function t=0 for dxy1=1 to l c=Abs(asc(Mid(thestr1,dxy1,1))) if c>255 then t=t+2 else t=t+1 end if if t>=strlen then thev=mid(thestr1,1,dxy1) exit