手机
当前位置:查字典教程网 >编程开发 >ASP教程 >几个常用的ASP函数
几个常用的ASP函数
摘要:========取得带端口的URL,推荐使用================FunctionGet_ScriptNameUrl()Ifreq...

========取得带端口的URL,推荐使用================

FunctionGet_ScriptNameUrl()

Ifrequest.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"))

EndIf

EndFunction

'=================用正则表达式突出显示字符串中查询到的单词的函数======================

FunctionBoldWord(strContent,word)

Ifword=""Then

BoldWord=strContent

ExitFunction

EndIF

dimobjRegExp

SetobjRegExp=newRegExp

objRegExp.IgnoreCase=true

objRegExp.Global=True

objRegExp.Pattern="("&word&")"

strContent=objRegExp.Replace(strContent,"<fontcolor=""#FF0000""><b>$1</b></font>")

SetobjRegExp=Nothing

BoldWord=strContent

EndFunction

'===============取得用户当前IP地址===================

FunctionGetIP()

uIP=Request.ServerVariables("HTTP_X_FORWARDED_FOR")

IfuIP=""ThenuIP=Request.ServerVariables("REMOTE_ADDR")

GetIp=uIP

EndFunction

'===============取得当前程序脚本路径==================

FunctionGetScriptName()

ScriptAddress=CStr(Request.ServerVariables("SCRIPT_NAME"))'取得当前地址

If(Request.QueryString<>"")Then

ScriptAddress=ScriptAddress&"?"&Server.HTMLEncode(Request.QueryString)'取得带参数地址

EndIf

IfLen(ScriptAddress)>250ThenScriptAddress=Left(ScirptAddress,250)&"..."'进行路径截取,最大为250个字符

GetScriptName=ScriptAddress

EndFunction

'===========返回带参数的Url,多关键字排序时使用==============

'RemoveList参数:需要从Url中去除的参数,可以是多个,中间请用逗号隔开

FunctionKeepUrlStr(RemoveList)

ScriptAddress=CStr(Request.ServerVariables("SCRIPT_NAME"))&"?"'取得当前地址,并加入“?”符号

M_ItemUrl=""

ForEachM_itemInRequest.QueryString

IfInStr(RemoveList,M_Item)=0Then

M_ItemUrl=M_ItemUrl&M_Item&"="&Server.URLEncode(Request.QueryString(""&M_Item&""))&"&"

EndIf

Next

KeepUrlStr=ScriptAddress&M_ItemUrl

EndFunction

【几个常用的ASP函数】相关文章:

简单的ASP中经常用到的代码[推荐]第1/4页

收藏的ASP常用的函数集

ASP中的EVAL函数使用教程

ASP采集入库生成本地文件的几个函数

使用ASP中的VB ActiveX.dll文件

ASP中常用的变量命名规则

ASP常用函数:getIMG()

在ASP中利用ADO显示Excel文件内容的函数

收集整理的ASP的常用内置函数

asp 中常用的文件处理函数

精品推荐
分类导航