脚本宝典收集整理的这篇文章主要介绍了几个常用的ASP函数,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
========取得带端口的URL,推荐使用================&nbs
p; Function Get_ScriptN
ameUrl()
If request.server
VARiables("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
'=================用正则表达式突出显示字符串中查询到的单词的函数======================
Function BoldWord(strContent,word)
If word="" Then
BoldWord = strContent
Ex
IT Function
End IF
dim objRegE
xp 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
'===============取得用户当前IP地址===================
Function GetIP()
uIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If uIP = "" Then uIP = Request.ServerVariables("REMOTE_ADDR")
GetIp = uIP
End Function
'===============取得当前程序脚本路径==================
Function GetScriptName()
ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME"))'取得当前地址
If (Request.QueryString <> "") Then
ScriptAddress = ScriptAddress & "?" & Server.HT
MLEncode(Request.QueryString)'取得带参数地址
End If
If Len(ScriptAddress)>250 Then ScriptAddress = Left(ScirptAddress,250)&"
..." '进行路径截取,最大为25
0个字符
GetScriptName = ScriptAddress
End Function
'===========返回带参数的Url,多关键字排序时使用==============
' RemoveList 参数:需要从Url中去除的参数,可以是多个,中间请用逗号隔开
Function KeepUrlStr(RemoveList)
ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME"))&"?"'取得当前地址,并加入“?”符号
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
脚本宝典总结
以上是脚本宝典为你收集整理的几个常用的ASP函数全部内容,希望文章能够帮你解决几个常用的ASP函数所遇到的问题。
如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。