让我们一起爱米兰
站内搜搜:
移动设备
请扫描二维码
或访问
m.milan100.com
您所在的位置 -> 米兰百分百 -> ASP -> asp将textarea里的内容格式转换为html代码的函数

asp将textarea里的内容格式转换为html代码的函数

点击数:1526 发表时间:2010-07-27 11:08:04 作者: 来源链接:
分享到:
分享到微信

FUNCTION txtToURL(tekst)
Tekst_temp = tekst


Tekst_temp = Replace(Tekst_temp,"<","&lt;")
Tekst_temp = Replace(Tekst_temp,">","&gt;")
Tekst_temp = Replace(Tekst_temp,"chr(13)","<BR>")
Tekst_temp = Replace(Tekst_temp,"chr(10)","<BR>")
Tekst_temp = Replace(Tekst_temp,"#","<BR>")
Tekst_temp = Replace(Tekst_temp,Chr(13),"<BR>")
Tekst_temp = Replace(Tekst_temp,"[","<B>")
Tekst_temp = Replace(Tekst_temp,"]","</B>")
i = 1
While not InStr(i,Tekst_temp,"{") = 0
start = CInt( InStr(1,Tekst_temp,"{") )
i = start
slutt = CInt( InStr(start,Tekst_temp,"}") )
hole = mid(Tekst_temp,(start),(slutt-start+1))
if InStr(hole,"$") then
 skille = CInt( InStr(start,Tekst_temp,"$") )
 navn = mid(Tekst_temp,(start+1),(skille-start-1))
 link = mid(Tekst_temp,(skille+1),(slutt-skille-1))
 if Left(link,4) = "www." then
     link = "http://" & link
 end if 'www
 if not InStr(link,"@") = 0 then
     link = "mailto:" & link
 end if '@
 out_var = "<A HREF=""" & link & """>" & navn & "</A>"
 Tekst_temp = Replace(Tekst_temp,hole,out_var,1,1)
else
 link = mid(Tekst_temp,(start+1),(slutt-start-1))
 if Left(link,4) = "www." then
     link = "http://" & link
 end if 'www
 if not InStr(link,"@") = 0 then
     link = "mailto:" & link
 end if '@
 link = "<A HREF=""" & link & """>"
 Tekst_temp = Replace(Tekst_temp,"{",link,1,1)
 Tekst_temp = Replace(Tekst_temp,"}","</A>",1,1)
end if
wend
txtToURL = Tekst_temp
END FUNCTION
0
很 好
0
一 般
0
差 劲
热门新闻
相关文章
上一篇: ASP之对象总结
下一篇: ASP+MsSqlServer 存储过程分页
评论区
匿名

返回首页 | 收藏本页 | 回到顶部
Copyright 2010. 米兰百分百 Powered By Bridge.
京ICP备15050557号