tjenare!
Krypin kod igen..
<%
' #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
' # #
' # AAA SSSS PPPP SSSS I DDDD AAA N N #
' # A A S P P S I D D A A NN N #
' # AAAAA SSS PPPP SSS I D D AAAAA N N N #
' # A A S P S I D D A A N NN #
' # A A SSSS P SSSS I DDDD A A N N #
' # #
' # Denna funktion är skriven av Mattias Järnhäll #
' # på [url]www.aspsidan.nu,[/url] och får användas fritt i #
' # ett icke komersielt syfte! #
' # #
' # För mer information gå till: [url]www.aspsidan.nu[/url] #
' # Epost: [email]mattias@aspsidan.nu[/email] #
' # #
' #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
Function make_link(txt)
' Initiering i början
txt = Replace(server.HTMLEncode(txt),vbCrlf,"<br>")
sPos = inStr(lCase(txt),"http://") ' Hämtar positionen för första länken
' Fyll denna array med tecken som avslutar en länk << HÄR KAN DU ÄNDRA OM DU VILL >>
stoppa = Array(";",","," ","!","<",">")
Do While sPos <> 0 AND sPos < len(txt)
' Initiering av grejer i lopen
startLink = sPos ' Länkens startpos
tmpChar = "" ' Nollställ
tmpLink = "" ' Nollställ
stop_it = "FALSE"
' Plocka ut namnet på länken
Do Until sPos > len(txt)+1 OR stop_it = "TRUE"
tmpLink = tmpLink & tmpChar
tmpChar = Mid(txt,sPos,1)
endLink = sPos - 1
sPos = sPos + 1
For X = 0 To Ubound(stoppa) ' Kollar om tmpChar är ogiltig
If tmpChar = stoppa(X) Then stop_it = "TRUE"
Next
Loop
vanster = Left(txt,startLink-1) ' Texten till vänster om länken
hoger = Right(txt,len(txt)-endLink) ' Texten till höger om länken
' Sätt ihop den nya texten, med länk!
txt = vanster & "<a href='" & tmpLink & "' target = '_blank'>"_
& tmpLink & "</a>" & hoger
' Leta fram nästa länk
jumpTo = endLink + 33 + len(tmpLink)
sPos = inStr(jumpTo,lCase(txt),"http://")
Loop
' Tillåten HTML kod
txt = Replace(txt,"[c]","<center>")
txt = Replace(txt,"[/c]","</center>")
txt = Replace(txt,"[r]","<right>")
txt = Replace(txt,"[/r]","</right>")
txt = Replace(txt,"[l]","<left>")
txt = Replace(txt,"[/l]","</left>")
txt = Replace(txt,"[b]","<b>")
txt = Replace(txt,"[/b]","</b>")
txt = Replace(txt,"[i]","<i>")
txt = Replace(txt,"[/i]","</i>")
txt = Replace(txt,"[u]","<u>")
txt = Replace(txt,"[/u]","</u>")
txt = Replace(txt,"[h3]","<h3>")
txt = Replace(txt,"[/h3]","</h3>")
txt = Replace(txt,"[h5]","<h5>")
txt = Replace(txt,"[/h5]","</h5>")
txt = Replace(txt,"[blue]","<font color=""blue"">")
txt = Replace(txt,"[/blue]","</font>")
txt = Replace(txt,"[white]","<font color=""white"">")
txt = Replace(txt,"[/white]","</font>")
txt = Replace(txt,"[red]","<font color=""red"">")
txt = Replace(txt,"[/red]","</font>")
txt = Replace(txt,"[yellow]","<font color=""yellow"">")
txt = Replace(txt,"[/yellow]","</font>")
txt = Replace(txt,"[skyblue]","<font color=""skyblue"">")
txt = Replace(txt,"[/skyblue]","</font>")
txt = Replace(txt,"[remsa]","<marquee>")
txt = Replace(txt,"[/remsa]","</marquee>")
' lite "fula-ord"-koll:
txt = Replace(txt,"FAN","***")
txt = Replace(txt,"KUK","***")
txt = Replace(txt,"FITTA","*****")
make_link = txt
End Function
%>
Sådär, nu e de så, att allt funkar utom:
txt = Replace(txt,"[blue]","<font color=""blue"">")
txt = Replace(txt,"[/blue]","</font>")
txt = Replace(txt,"[white]","<font color=""white"">")
txt = Replace(txt,"[/white]","</font>")
txt = Replace(txt,"[red]","<font color=""red"">")
txt = Replace(txt,"[/red]","</font>")
txt = Replace(txt,"[yellow]","<font color=""yellow"">")
txt = Replace(txt,"[/yellow]","</font>")
txt = Replace(txt,"[skyblue]","<font color=""skyblue"">")
txt = Replace(txt,"[/skyblue]","</font>")
txt = Replace(txt,"[remsa]","<marquee>")
txt = Replace(txt,"[/remsa]","</marquee>")
Varför inte??