·您的位置: 首页 » 资源教程 » 编程开发 » ASP » 转换字符串带有HTTP://的超级链接字符串为真正的超级链接

转换字符串带有HTTP://的超级链接字符串为真正的超级链接

类别: ASP教程  评论数:0 总得分:0
<%
Function LinkURLs(strInput)
iCurrentLocation = 1
Do While InStr(iCurrentLocation, strInput, "http://", 1) <> 0
iLinkStart = InStr(iCurrentLocation, strInput, "http://", 1)
iLinkEnd = InStr(iLinkStart, strInput, " ", 1)
If iLinkEnd = 0 Then iLinkEnd = Len(strInput) + 1
Select Case Mid(strInput, iLinkEnd - 1, 1)
Case ".", "!", "?"
iLinkEnd = iLinkEnd - 1
End Select
strOutput = strOutput & Mid(strInput, iCurrentLocation, iLinkStart - iCurrentLocation)
strLinkText = Mid(strInput, iLinkStart, iLinkEnd - iLinkStart)
strOutput = strOutput & "<a href="""&strLinkText&""">"&strLinkText&"</a>"
iCurrentLocation = iLinkEnd
Loop
strOutput = strOutput & Mid(strInput, iCurrentLocation)
LinkURLs = strOutput
End Function
strUnlinked = "http://LINE9.com rules! <br>" & vbCrLf
strUnlinked = strUnlinked & "http://pdxpc.com sells great computers!<br>" & vbCrLf

\' Here is the before text:
Response.Write "<b>Original Text:</b><br>" & vbCrLf
Response.Write strUnlinked
Response.Write vbCrLf & "<br>" & vbCrLf & vbCrLf

\' Here is the text after it gets automatically hyperlinked to itself:
Response.Write "<b>Text After Linking:</b><br>" & vbCrLf
Response.Write LinkURLs(strUnlinked)
%>
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1