手机
当前位置:查字典教程网 >编程开发 >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实现无组件生成验证码的方法2种

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

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

用ASP开发网页需要牢记的注意事项

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

asp ubb代码转换成html代码

研究动网得到的一些动网参数

用ASP实现对MP3曲目信息的操作

asp实现sql的备份与恢复

asp:生成静态页面函数

精品推荐
分类导航