手机
当前位置:查字典教程网 >编程开发 >ASP教程 >用asp实现网址和邮件地址的转换函数
用asp实现网址和邮件地址的转换函数
摘要:网址和邮件地址的转换函数=45)and(asc(midurlstr)=45)and(asc(midmailstr)=45)and(asc(m...

网址和邮件地址的转换函数

<%

functionURLconvert(str)

convertstr=str

urlLocation=instr(convertstr,"http://")

if(urlLocation=0)and(mailLocation=0)then

URLconvert=convertstr

exitfunction

endif

ifurlLocation<>0then

rightstr=str

DowhileurlLocation<>urlLocationend

urlLocation=instr(rightstr,"http://")

urlLocationend=InStrRev(rightstr,"http://")

finalstr=finalstr&left(rightstr,urlLocation-1)

midurlstr=mid(rightstr,urlLocation+1,1)

dowhile(asc(midurlstr)>=45)and(asc(midurlstr)<=126)

loopint=loopint+1

midurlstr=mid(rightstr,urlLocation+loopint,1)

ifmidurlstr=""thenexitdo

loop

endURLstr=mid(rightstr,urllocation,loopint)

URLstr="<ahref="&endURLstr&">"&endURLstr&"</a>"

rightstr=mid(rightstr,urllocation+loopint)

finalstr=finalstr&URLstr

loopint=1

Loop

endif

finalstr=finalstr&rightstr

convertstr1=finalstr

finalstr=""

mailLocation=instr(convertstr1,"@")

ifmailLocation<>0then

DowhilemailLocation<>mailLocationend

mailLocation=instr(convertstr1,"@")

mailLocationend=InStrRev(convertstr1,"@")

mainmidmailstr=mid(convertstr1,mailLocation+1,1)

midmailstr=mainmidmailstr

dowhile(asc(midmailstr)>=45)and(asc(midmailstr)<=126)

loopint1=loopint1+1

midmailstr=mid(convertstr1,mailLocation-loopint1,1)

loop

firstSTR=mid(convertstr1,mailLocation-loopint1+1,loopint1-1)

finalstr=finalstr&left(convertstr1,mailLocation-loopint1)

midmailstr1=mainmidmailstr

dowhile(asc(midmailstr1)>=45)and(asc(midmailstr1)<=126)

loopint2=loopint2+1

midmailstr1=mid(convertstr1,mailLocation+loopint2,1)

ifmidmailstr1=""thenexitdo

loop

secondSTR=mid(convertstr1,mailLocation,loopint2)

endmailstr=firstSTR&secondSTR

mailstr="<ahref=mailto:"&endmailstr&">"&endmailstr&"</a>"

finalstr=finalstr&mailstr

convertstr1=mid(convertstr1,maillocation+loopint2)

loopint1=1

loopint2=1

Loop

endif

finalstr=finalstr&convertstr1

URLconvert=finalstr

endfunction

%>

【用asp实现网址和邮件地址的转换函数】相关文章:

用asp实现的数据库中存取文件的代码

用ASP打开远端MDB文件的方法

用XML+FSO+JS实现服务器端文件的

asp实现无限级分类的方法js版

asp 简单ubb代码转换程序

用asp实现检测文件编码

asp获取用户真实IP地址的方法

用asp实现无组件生成验证码的方法2种

asp之字符串操作函数

在ASP中用组件检测当前网卡地址的代码

精品推荐
分类导航