|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
asp是基于web的一种编程技术,可以说是cgi的一种。它可以完成以往cgi程序的所有功能,如计数器、留言簿、公告板、聊天室等等。Thisfunctiontakesastringasinputandlinksany"http"itfindssothattheyarethenclickableinabrowser.
SampleUsage:
response.writeLinkURLS("Pleasevisitmywebsiteathttp://www.5dm.cn").
ThiswillautomaticallyinserttheAHREFtagintheappropriateplace.
<%
FunctionLinkURLs(strInput)
Thisfunctiontakesastringasinputandlinksanyhttpsit
findssothattheyarethenclickableinabrowser.
DimiCurrentLocationOurcurrentpositionintheinputstring
DimiLinkStartBeginningpositionofthecurrentlink
DimiLinkEndEndingpositionofthecurrentlink
DimstrLinkTextTextwereconvertingtoalink
DimstrOutputReturnstringwithlinksinit
Startatthefirstcharacterinthestring
iCurrentLocation=1
Lookforhttp://inthetextfromthecurrentpositionto
theendofthestring.Ifwefinditthenwestartthe
linkingprocessotherwiseweredonebecausethereareno
morehttp://sinthestring.
DoWhileInStr(iCurrentLocation,strInput,"http://",1)0
Setthepositionofthebeginningofthelink
iLinkStart=InStr(iCurrentLocation,strInput,"http://",1)
Setthepositionoftheendofthelink.Iusethe
firstspaceasthedeterminingfactor.
iLinkEnd=InStr(iLinkStart,strInput,"",1)
makesuretherwasnolinebreak.Iftherewasalinebreakbeforethe
space,setthatastheend.
checkBreak=InStr(iLinkStart,strInput,chr(13),1)
ifcheckBreak>0andcheckBreak<iLinkEndtheniLinkEnd=checkbreak
Ifwedidntfindaspacethenwelinktothe
endofthestring
IfiLinkEnd=0TheniLinkEnd=Len(strInput)+1
Takecareofanypunctuationwepickedup
SelectCaseMid(strInput,iLinkEnd-1,1)
Case",",".","!","?"
iLinkEnd=iLinkEnd-1
EndSelect
Thisaddstotheoutputstringallthenonlinkedstuff
uptothelinkwerecurentlyprocessing.
strOutput=strOutput&Mid(strInput,iCurrentLocation,_
iLinkStart-iCurrentLocation)
Getthetextwerelinkingandstoreitinavariable
strLinkText=Mid(strInput,iLinkStart,iLinkEnd-iLinkStart)
Buildourlinkandappendittotheoutputstring
strOutput=strOutput&"<AHREF="""&strLinkText&"""target=""_blank"">"_
&strLinkText&"</A>"
Somegoodolddebugging
Response.WriteiLinkStart&","&iLinkEnd&"
&vbCrLf
Resetourcurrentlocationtotheendofthatlink
iCurrentLocation=iLinkEnd
Loop
Tackontheendofthestring.Ineedtodothissowe
dontmissanytrailingnon-linkedtext
strOutput=strOutput&Mid(strInput,iCurrentLocation)
Setthereturnvalue
LinkURLs=strOutput
EndFunctionLinkURLs
%>使用cdonts,可以发送、查看邮件,实现webmail的功能。结合wsh,可以实现对nt主机的管理,如nt用户管理、iis虚拟主机设置、exchange邮箱设置等等,就像管理本地机一样方便。 |
|