Frågan 1 juni 2007 07:35 #1 Jag använder mina egna HTML koder med RegExp som nästan alla gör för att skydda sig från andra HTML koder.
Men problmet för mig är att jag kan bara använda några koder en gång eller så när jag använder <b></b> blir alla text fett.
<%
Function ForumHTML(ByVal strText)
strText = Replace(Server.HTMLEncode(strText),vbCrlf,"<br>")
Set objRegExp = New regexp
objRegExp.Global = true
objRegExp.IgnoreCase = true
objRegExp.Pattern = "(http://(\w|\.|/|-|\?|=|&|;|~){1,}\w*)"
strText = objRegExp.replace(strtext,"<a href=""$1"" target=""_blank"">$1</a>")
objRegExp.Pattern="\<img src="([\w\W]*?)">"
strText = objRegExp.replace(strText,"<img src=""$1"">")
objRegExp.pattern="\<font color="([^&]*)"\>([^\[]*)\</font\>"
strText = objRegExp.Replace(strtext,"<font color=""$1"">$2</font>")
objRegExp.pattern="\<font size="([\w\W]*?)"\>([^\[]*)\</font\>"
strText = objRegExp.Replace(strtext,"<font size=""$1"">$2</font>")
objRegExp.pattern="\<font face="([\w\W]*?)"\>([^\[]*)\</font\>"
strText = objRegExp.Replace(strtext,"<font face=""$1"">$2</font>")
objRegExp.pattern="\<ul> <li>([^\[]*)\</li> </ul>"
strText = objRegExp.Replace(strtext,"<ul> <li>$1</ul> </li>")
strText = Replace(strText,":)","<img src=""../_Grafik/Smilies/smile.gif"">")
strText = Replace(strText,":(","<img src=""../_Grafik/Smilies/sur.gif"">")
strText = Replace(strText,";)","<img src=""../_Grafik/Smilies/blink.gif"">")
strText = Replace(strText,":'(","<img src=""../_Grafik/Smilies/cry.gif"">")
strText = Replace(strText,":$","<img src=""../_Grafik/Smilies/blush.gif"">")
strText = Replace(strText,":D","<img src=""../_Grafik/Smilies/garv.gif"">")
strText = Replace(strText,":d","<img src=""../_Grafik/Smilies/garv.gif"">")
strText = Replace(strText,":@","<img src=""../_Grafik/Smilies/angry.gif"">")
strText = Replace(strText,":o","<img src=""../_Grafik/Smilies/happen.gif"">")
strText = Replace(strText,":O","<img src=""../_Grafik/Smilies/happen.gif"">")
strText = Replace(strText,"(L)","<img src=""../_Grafik/Smilies/heart.gif"">")
strText = Replace(strText,"halay","<img src=""../_Grafik/Smilies/halay.gif"">")
strText = Replace(strText,"Halay","<img src=""../_Grafik/Smilies/halay.gif"">")
strText = Replace(strText,"peace","<img src=""../_Grafik/Smilies/peace.gif"">")
strText = Replace(strText,"Peace","<img src=""../_Grafik/Smilies/peace.gif"">")
strText = Replace(strText,"<b>", "<b>")
strText = Replace(strText,"</b>", "</b>")
strText = Replace(strText,"<i>", "<i>")
strText = Replace(strText,"</i>", "</i>")
strText = Replace(strText,"<u>", "<u>")
strText = Replace(strText,"</i>", "</u>")
strText = Replace(strText,"<center>","<div align='center'>")
strText = Replace(strText,"</center>","</div>")
strText = Replace(strText,"<right>","<div align=""right"">")
strText = Replace(strText,"</right>","</div>")
ForumHTML = strText
End function
%>