Hov, det må du undskylde:
Function addLinks(sInput, sTarget)
Dim sNew, sPunct
' Define punctuation characters
sPunct = "_-+=!?.,;:`~'""*^$%()[]{}<>|"
' Assign input string to local variable so we don't change the
' original string.
sNew = sInput
' Split the string by whitespace: spaces, carriage returns, line feeds,
' and tabs. Then, for each "word" in the string...
For Each sVal1 in Split(sNew, " ")
For Each sVal2 in Split(sVal1, vbcr)
For Each sVal3 in Split(sVal2, vblf)
For Each sVal4 in Split(sVal3, Chr(9))
' Remove beginning and ending punctuation
bStop = FALSE
Do While (Not bStop)
If (Instr(sPunct, Left(sVal4, 1)) <> 0 And Len(sVal4) > 2) Then
sVal4 = Mid(sVal4, 2)
Else
bStop = TRUE
End If
Loop
bStop = FALSE
Do While (Not bStop)
If (Instr(sPunct, Right(sVal4, 1)) <> 0 And Len(sVal4) > 2) Then
sVal4 = Left(sVal4, Len(sVal4) - 1)
Else
bStop = TRUE
End If
Loop
' If the word begins with http:// then convert all occurrences
' of this word to a hyperlink.
If (LCase(Left(sVal4, 7) = "
http://") Or LCase(Left(sVal4, 4) = "www.")) Then
If (LCase(Left(sVal4, 4) = "www.")) Then
If (sTarget = "") then
sNew = Replace(sNew, sVal4, "<A HREF=""
http://" & sVal4 & """>" & sVal4 & "</A>")
Else
sNew = Replace(sNew, sVal4, "<A HREF=""
http://" & sVal4 & " TARGET=""" & sTarget & """>" & sVal4 & "</A>")
End If
Else
If (sTarget = "") then
sNew = Replace(sNew, sVal4, "<A HREF=""" & sVal4 & """>" & sVal4 & "</A>")
Else
sNew = Replace(sNew, sVal4, "<A HREF=""" & sVal4 & " TARGET=""" & sTarget & """>" & sVal4 & "</A>")
End If
End If
End If
' If this word looks like an e-mail address then convert all
' occurrences into a mailto: link.
If (Instr(sVal4, "@") >= 2 And Instr(sVal4, ".") <> 0 And Len(sVal4) >= 5) Then
sNew = Replace(sNew, sVal4, "<A HREF=""mailto:" & sVal4 & """>" & sVal4 & "</A>")
End If
Next
Next
Next
Next
' Return converted string
addLinks = sNew
End Function
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("guestbook.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnectString
sql = "SELECT * FROM guestbook ORDER BY datetime DESC"
Set rsEntries = Server.CreateObject("ADODB.Recordset")
rsEntries.Open sql, conn, 3, 3
%>
<html>
<head>
<title>..:: blablabla ::..</title>
<SCRIPT src="../images/menu/js.js" type=text/javascript></SCRIPT>
<LINK href="../images/menu/epictime_tagwall.css" type=text/css rel=stylesheet>
</head>
<body link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF" id="body">
</body>
<br><br>
<div align="center"><table class="seksten">
<tr>
<td></td>
<td></td>
<td><p><div align="center"><img src="../images/tagwall_sort.jpg" alt="" width="79" height="12" border="0"><br><br><a onmouseover="window.status='Tilføj en besked'; return true"onMouseOut="window.status=''" href="tilfoj.asp">Tilføj besked</a></div></p>
<hr class="borderstagwall">
<a name="messagetop"></a>
<%if rsEntries.EOF then%>
<p align="left">Ingen beskeder i oversigten</p>
<p>
<%else
rsEntries.Movefirst
'If viewing a previous set of messages, move to the right position
if Request.QueryString("recordnum") <> "" then
rsEntries.Move(Request.QueryString("recordnum"))
end if
for count = 1 to 15%>
<b>Skrevet af:</b> <%=rsEntries("by")%><br>
<b>Skrevet den:</b> <%=rsEntries("datetime")%><br>
<br>
<b>Besked:</b><br><br>
<% Response.Write(AddLinks(rsEntries("message")),"_self")%>
</font>
<hr class="borderstagwall">
<%rsEntries.Movenext
'Quit loop if no more messages left
if rsEntries.EOF then
exit for
end if
next
'If there's still some more messages after displaying the first 20, display a link to the next page, using the .AbsolutePosition property as a placeholder (an ID field in the database is not reliable enough if manual DB deletions occur)
'We use .AbsolutePostion - 1 because we've already done a .Movenext onto the record we want to display first on the next page
if not rsEntries.EOF then%>
</font>
<p><b>
<a onmouseover="window.status='Gamle beskeder'; return true"onMouseOut="window.status=''" href="guestbook.asp?recordnum=<%=rsEntries.AbsolutePosition - 1%>">
Forrige beskeder
</a></b></p>
<%end if%>
<%end if%>
</center>
</font></td>
<td></td>
</tr>
</table></div>
</html>
<%
rsEntries.close
set rsEntries = nothing
conn.close
set conn = nothing
%>
-Du skal oxo lige angive hvad du vil ha' som target ;o) -Prøv som den er nu!
//>Rune