收藏的ASP常用的函數(shù)集
當(dāng)前位置:點(diǎn)晴教程→知識(shí)管理交流
→『 技術(shù)文檔交流 』
ASP函數(shù)集 '========取得帶端口的URL,推薦使用================ Function Get_ScriptNameUrl() If request.servervariables("SERVER_PORT")="80" Then Get_ScriptNameUrl="http://" & request.servervariables("server_name")&lcase(request.servervariables("script_name")) Else Get_ScriptNameUrl="http://" & request.servervariables("server_name")&":"&request.servervariables("SERVER_PORT")&lcase(request.servervariables("script_name")) End If End Function '=================用jsp表達(dá)式突出顯示字符串中查詢到的單詞的函數(shù)====================== Function BoldWord(strContent,word) If word="" Then BoldWord = strContent Exit Function End IF dim objRegExp Set objRegExp=new RegExp objRegExp.IgnoreCase =true objRegExp.Global=True objRegExp.Pattern="(" & word & ")" strContent=objRegExp.Replace(strContent,"<font color=""#FF0000""><b>$1</b></font>" ) Set objRegExp=Nothing BoldWord=strContent End Function '===============取得用戶當(dāng)前IP地址=================== Function GetIP() uIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR") If uIP = "" Then uIP = Request.ServerVariables("REMOTE_ADDR") GetIp = uIP End Function '===============取得當(dāng)前程序腳本路徑================== Function GetScriptName() ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME"))'取得當(dāng)前地址 If (Request.QueryString <> "") Then ScriptAddress = ScriptAddress & "?" & Server.HTMLEncode(Request.QueryString)'取得帶參數(shù)地址 End If If Len(ScriptAddress)>250 Then ScriptAddress = Left(ScirptAddress,250)&"..." '進(jìn)行路徑截取,最大為250個(gè)字符 GetScriptName = ScriptAddress End Function '===========返回帶參數(shù)的Url,多關(guān)鍵字排序時(shí)使用============== ' RemoveList 參數(shù):需要從Url中去除的參數(shù),可以是多個(gè),中間請用逗號(hào)隔開 Function KeepUrlStr(RemoveList) ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME"))&"?"'取得當(dāng)前地址,并加入“?”符號(hào) M_ItemUrl = "" For Each M_item In Request.QueryString If InStr(RemoveList,M_Item)=0 Then M_ItemUrl = M_ItemUrl & M_Item &"="& Server.URLEncode(Request.QueryString(""&M_Item&"")) & "&" End If Next KeepUrlStr = ScriptAddress & M_ItemUrl End Function 該文章在 2011/2/16 10:46:18 編輯過 |
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |