Avatar billede metal_hansen Nybegynder
20. oktober 2002 - 21:17 Der er 36 kommentarer og
1 løsning

Få links til at blive klikbare i min acces-tagwall

jeg har en simpel tagwall i asp, hvor indholdet blir hentet i en acces-fil. Jeg vil gerne ha at hvis man skriver et link i en besked, så blir linket klikbart - i mit tilfælde vil jeg gerne ha at det skal blive fremhævet vha. en fade-effekt, som ligger i en .js-fil.

Anybody?!
Avatar billede metal_hansen Nybegynder
20. oktober 2002 - 21:29 #1
min kode ser sådan her ud:


<%
Option Explicit
Dim ConnectString,sql,conn,rsEntries,count

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>
<%=rsEntries("message")%>

</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
%>
Avatar billede medions Nybegynder
21. oktober 2002 - 00:51 #2
Brug denne:

Function LinkString(strInput)
    Set objRegExpHTTP1 = New RegExp
    Set objRegExpHTTP2 = New RegExp   
    Set objRegExpEMail = New RegExp

    objRegExpHTTP1.Pattern = "(http|ftp)(:\\/\\/[\\w\\._-]+\\.[\\w\\._-]+\\S*)"
    objRegExpHTTP2.Pattern = "(^|[^\\/])(www[^\\.\\s]?\\.[\\w\\._-]+\\.[A-Za-z]{2,3}\\S*)"
    objRegExpEMail.Pattern = "([\\w\\._-]+@[\\w\\._-]+\\.[A-Za-z]{2,3}\\S*)"

    objRegExpHTTP1.Global = True
    objRegExpHTTP2.Global = True
    objRegExpEMail.Global = True

    objRegExpHTTP1.IgnoreCase = True
    objRegExpHTTP2.IgnoreCase = True
    objRegExpEMail.IgnoreCase = True

    strOutput = objRegExpEMail.Replace(strInput, " <a href=\'mailto:$1\'>$1</a> ")
    strOutput = objRegExpHTTP1.Replace(strOutput, " <a href=\'$1$2\' target=\'_blank\'>$1$2</a> ")
    strOutput = objRegExpHTTP2.Replace(strOutput, " <a href=\'http://$2\' target=\'_blank\'>$2</a> ")
       
    Set objRegExpHTTP2 = Nothing
    set objRegExpHTTP1 = Nothing
    Set objRegExpEMail = Nothing

    LinkString = strOutput
End Function



eks:
Response.Write LinkString(rs("tekstfelt"))

//>Rune
Avatar billede metal_hansen Nybegynder
21. oktober 2002 - 03:03 #3
takker - men hvor skal det stå henne?! Jeg ved intet om asp..
Avatar billede medions Nybegynder
21. oktober 2002 - 07:24 #4
Du skal blot omklamre det sted hvor du vil ha' skrevet det ud med LinkString()

Fx sådan her:


<%
Option Explicit
Dim ConnectString,sql,conn,rsEntries,count

Function LinkString(strInput)
    Set objRegExpHTTP1 = New RegExp
    Set objRegExpHTTP2 = New RegExp   
    Set objRegExpEMail = New RegExp

    objRegExpHTTP1.Pattern = "(http|ftp)(:\\/\\/[\\w\\._-]+\\.[\\w\\._-]+\\S*)"
    objRegExpHTTP2.Pattern = "(^|[^\\/])(www[^\\.\\s]?\\.[\\w\\._-]+\\.[A-Za-z]{2,3}\\S*)"
    objRegExpEMail.Pattern = "([\\w\\._-]+@[\\w\\._-]+\\.[A-Za-z]{2,3}\\S*)"

    objRegExpHTTP1.Global = True
    objRegExpHTTP2.Global = True
    objRegExpEMail.Global = True

    objRegExpHTTP1.IgnoreCase = True
    objRegExpHTTP2.IgnoreCase = True
    objRegExpEMail.IgnoreCase = True

    strOutput = objRegExpEMail.Replace(strInput, " <a href=\'mailto:$1\'>$1</a> ")
    strOutput = objRegExpHTTP1.Replace(strOutput, " <a href=\'$1$2\' target=\'_blank\'>$1$2</a> ")
    strOutput = objRegExpHTTP2.Replace(strOutput, " <a href=\'http://$2\' target=\'_blank\'>$2</a> ")
       
    Set objRegExpHTTP2 = Nothing
    set objRegExpHTTP1 = Nothing
    Set objRegExpEMail = Nothing

    LinkString = strOutput
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(LinkString(rsEntries("message")))%>

</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
%>

//>Rune
Avatar billede metal_hansen Nybegynder
21. oktober 2002 - 13:03 #5
hmm - jeg får flg. fejl:


HTTP 500,100 - Intern fejl på serveren - ASP-fejl -
Internet Information Services

--------------------------------------------------------------------------------

Tekniske oplysninger (for supportteknikere)

Fejltype:
Der opstod en Microsoft VBScript-kørselsfejl (0x800A01F4)
Variablen er ikke defineret: 'objRegExpHTTP1'
/epictime/tagwall/guestbook.asp, line 6


Browsertype:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Side:
GET /epictime/tagwall/guestbook.asp
Avatar billede medions Nybegynder
21. oktober 2002 - 15:41 #6
Jamen så definer den!

Skriv:

Dim objRsgExpHTTP1

//>Rune
Avatar billede metal_hansen Nybegynder
21. oktober 2002 - 17:32 #7
jamen *hulk* gider du ikke lige sætte den ind der hvor den skal være - og så paste hele molevitten én gang for alle?! Jeg aner som sagt intet som helst om hvad det er jeg laver..
Avatar billede medions Nybegynder
21. oktober 2002 - 22:48 #8
<%
Option Explicit
Dim ConnectString,sql,conn,rsEntries,count
Dim objRegExpHTTP1,objRegExpHTTP2,objRegExpEMail,strOutPut,strInput

Function LinkString(strInput)
    Set objRegExpHTTP1 = New RegExp
    Set objRegExpHTTP2 = New RegExp   
    Set objRegExpEMail = New RegExp

    objRegExpHTTP1.Pattern = "(http|ftp)(:\\/\\/[\\w\\._-]+\\.[\\w\\._-]+\\S*)"
    objRegExpHTTP2.Pattern = "(^|[^\\/])(www[^\\.\\s]?\\.[\\w\\._-]+\\.[A-Za-z]{2,3}\\S*)"
    objRegExpEMail.Pattern = "([\\w\\._-]+@[\\w\\._-]+\\.[A-Za-z]{2,3}\\S*)"

    objRegExpHTTP1.Global = True
    objRegExpHTTP2.Global = True
    objRegExpEMail.Global = True

    objRegExpHTTP1.IgnoreCase = True
    objRegExpHTTP2.IgnoreCase = True
    objRegExpEMail.IgnoreCase = True

    strOutput = objRegExpEMail.Replace(strInput, " <a href=\'mailto:$1\'>$1</a> ")
    strOutput = objRegExpHTTP1.Replace(strOutput, " <a href=\'$1$2\' target=\'_blank\'>$1$2</a> ")
    strOutput = objRegExpHTTP2.Replace(strOutput, " <a href=\'http://$2\' target=\'_blank\'>$2</a> ")
       
    Set objRegExpHTTP2 = Nothing
    set objRegExpHTTP1 = Nothing
    Set objRegExpEMail = Nothing

    LinkString = strOutput
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(LinkString(rsEntries("message")))%>

</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
%>

Så prøv lige med denne ;o)

//>Rune
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 06:24 #9
hmmm  - den kommer ikke med nogen fejl nu - men den laver heller ikke www.runehansen.tk f.eks. om til et klikbart link??!!
Avatar billede medions Nybegynder
22. oktober 2002 - 07:06 #10
prøv at lav en record der indeholder en email adresse!

//>Rune
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 07:14 #11
ok har jeg lige prøvet - det virker heller ikke..
hvis du gerne vil se siden, så læg en mailadresse - men det hjælper vel heller ikke..?!
Avatar billede medions Nybegynder
22. oktober 2002 - 07:15 #12
hmm måske..

rune@medions.dk

//>Rune
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 07:17 #13
sendt
Avatar billede medions Nybegynder
22. oktober 2002 - 07:25 #14
Function LinkTekst(Tekst)
LinkTekst = ""
A_Start = 1

if InStr(Tekst, "http://") then
  do until A_Start >= len(Tekst)
  LinkChr = InStr(A_Start, Tekst, "http://")
  NextSpace = InStr(LinkChr, Tekst, " ")

  if NextSpace = 0 then NextSpace = Len(Tekst) + 1

  URL = Mid(Tekst, LinkChr, NextSpace - LinkChr)

  LinkTekst = LinkTekst & Mid(Tekst, A_Start, LinkChr - A_Start)
  LinkTekst = LinkTekst & "<A Href=" & Chr(34) & URL & Chr(34) & ">" & URL & "</A>"

  if Int(LinkChr) = Int(InStrRev(Tekst, "http://")) then
    LinkTekst = LinkTekst & Mid(Tekst, NextSpace, Len(Tekst) - A_Start)
    A_Start = Len(Tekst)
  else
    A_Start = NextSpace
  end if
  loop
else
  LinkTekst = Tekst
end if
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(LinkTekst(rsEntries("message")))%>

</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
%>

Så prøver vi da bare med denne ;o)

//>Rune
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 07:28 #15
ok nu hjælper det på det :)
Linket du har lagt ind med http:// ser ud til at virke - men det ville jo altså være smartest hvis det også virker på www.blabla.dk etc..
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 07:30 #16
og kan det laves så target="_blank" - da tagwallen er inde i en frame, og så er det ikke så smart at siden åbnes i samme vindue
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 07:30 #17
du skal nok få en xtra røvfuld point for det her :)
Avatar billede medions Nybegynder
22. oktober 2002 - 07:33 #18
Prøv med denne:

Function LinkTekst(Tekst)
LinkTekst = ""
A_Start = 1

if InStr(Tekst, "http://") then
  do until A_Start >= len(Tekst)
  LinkChr = InStr(A_Start, Tekst, "http://")
  NextSpace = InStr(LinkChr, Tekst, " ")

  if NextSpace = 0 then NextSpace = Len(Tekst) + 1

  URL = Mid(Tekst, LinkChr, NextSpace - LinkChr)

  LinkTekst = LinkTekst & Mid(Tekst, A_Start, LinkChr - A_Start)
  LinkTekst = LinkTekst & "<A Href=" & Chr(34) & URL & Chr(34) & " target=""_blank"">" & URL & "</A>"

  if Int(LinkChr) = Int(InStrRev(Tekst, "http://")) then
    LinkTekst = LinkTekst & Mid(Tekst, NextSpace, Len(Tekst) - A_Start)
    A_Start = Len(Tekst)
  else
    A_Start = NextSpace
  end if
  loop
else
  LinkTekst = Tekst
end if

if InStr(Tekst, "www.") then
  do until A_Start >= len(Tekst)
  LinkChr = InStr(A_Start, Tekst, "www.")
  NextSpace = InStr(LinkChr, Tekst, " ")

  if NextSpace = 0 then NextSpace = Len(Tekst) + 1

  URL = Mid(Tekst, LinkChr, NextSpace - LinkChr)

  LinkTekst = LinkTekst & Mid(Tekst, A_Start, LinkChr - A_Start)
  LinkTekst = LinkTekst & "<A Href=" & Chr(34) & URL & Chr(34) & " target=""_blank"">" & URL & "</A>"

  if Int(LinkChr) = Int(InStrRev(Tekst, "www.")) then
    LinkTekst = LinkTekst & Mid(Tekst, NextSpace, Len(Tekst) - A_Start)
    A_Start = Len(Tekst)
  else
    A_Start = NextSpace
  end if
  loop
else
  LinkTekst = Tekst
end if
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(LinkTekst(rsEntries("message")))%>

</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
%>

//>Rune
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 07:36 #19
Yesyesyes - nu virker http:// dog ikke - og heller ikke mailto: - kan det komme med også - så vil det være perfekt :)
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 07:38 #20
... og target_ virker heller ikke - godt nok åbnes et nyt vindue - men stien er stien til siden + linket..
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 07:40 #21
hehe damn - og det ser ud til at posterne med links blir hentet 2 gange fra databasen
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 07:53 #22
jeg har sat point op til 200 :)
Håber du får det til at virke
Avatar billede medions Nybegynder
22. oktober 2002 - 07:55 #23
-jeg kører lige i skole, så hjælper jeg der der oppe fra..ok?

//>Rune
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 07:56 #24
ja ok - jeg ved dog ikke om jeg lige skal sove et par timer mere - så det kan godt være jeg ikke lige svarer med det samme - men vi når det vel også nok. Det haster såmænd ikke så vildt :)
Avatar billede medions Nybegynder
22. oktober 2002 - 08:00 #25
Ok, men prøve lige denne oxo ;o)

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")))%>

</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
%>

//>Rune
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 08:03 #26
på den får jeg flg. fejl:

HTTP 500,100 - Intern fejl på serveren - ASP-fejl -
Internet Information Services

--------------------------------------------------------------------------------

Tekniske oplysninger (for supportteknikere)

Fejltype:
Der opstod en Microsoft VBScript-kørselsfejl (0x800A01C2)
Antallet af argumenter er forkert eller egenskabstildelingen er ugyldig: 'addLinks'
/epictime/tagwall/guestbook.asp, line 123
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 08:06 #27
hvis du bruger ICQ, så har jeg nummer 118765206 - så er det nemmere at få fat på hinanden, hvis det er..
jeg tror jeg lige knalder brikker et par timer nu ;)
Avatar billede medions Nybegynder
22. oktober 2002 - 08:34 #28
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
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 08:37 #29
den gir:

Tekniske oplysninger (for supportteknikere)

Fejltype:
Der opstod en Microsoft VBScript-kompileringsfejl (0x800A0414)
Der kan ikke bruges parenteser ved kald af en Sub
/epictime/tagwall/guestbook.asp, line 123, column 54


(NU går jeg i seng ;)
Avatar billede medions Nybegynder
22. oktober 2002 - 11:52 #30
Ok, så prøver vi bare igen :o)

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
%>

//>Rune
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 14:13 #31
den gir:

Tekniske oplysninger (for supportteknikere)

Fejltype:
Der opstod en Microsoft VBScript-kompileringsfejl (0x800A03EE)
Tegnet ')' var ventet
/epictime/tagwall/guestbook.asp, line 123, column 24
Avatar billede medions Nybegynder
22. oktober 2002 - 14:24 #32
Prøv at skifte:
<% Response.Write(AddLinks rsEntries("message"),"_self")%>
ud med denne:
<%= addLinks(rsEntries("message"),"_Self")%>

//>Rune
Avatar billede medions Nybegynder
22. oktober 2002 - 14:26 #33
Ok, nu skulle den gerne virke ;o)

<%
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>
<%= addLinks(rsEntries("message"),"_top")%>

</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
%>

//>Rune
Avatar billede medions Nybegynder
22. oktober 2002 - 14:28 #34
<%
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>
<%= addLinks(rsEntries("message"),"_top")%>

</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
%>

NU skulle den gerne være der LOL, der var lige nogle småfejl hist og her...

//>Rune
Avatar billede medions Nybegynder
22. oktober 2002 - 14:40 #35
<%
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>
<%= addLinks(rsEntries("message"),"_blank")%>

</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
%>

Så var den der, undskyld alt bøvlet ;o)

//>Rune
Avatar billede metal_hansen Nybegynder
22. oktober 2002 - 14:42 #36
KANON! Det er bare noget der virker!
Så er der point :-)
Avatar billede medions Nybegynder
22. oktober 2002 - 14:43 #37
Fair nok ;o)
Thx 4 Poinz

//>Rune
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester