Add links med target i nyt vindue?
Tilføj link side.Jeg kunne godt tænke mig at de tilføjede links åbnede i et nyt browswevindue.Jeg får grå hår og er nybegynder.
Kan nogen hjælpe mig med dette.
Her er koden.
<% response.buffer = true %>
<html>
<head>
<title>Links</title>
<style type=\"text/css\">
<!--
body
{
background-color : \"979797\";
}
{margin-left: 95; margin-top: 35; font-family:verdana}
a.menuitem {text-decoration:none;color:#000000}
a.menuitem:hover {text-decoration:none;color:#FF0000}
a {text-decoration:none;color:#FFFFFF}
a:hover {text-decoration:none;color:#CC0000}
INPUT
{
BACKGROUND-COLOR: #FFFFFF;
COLOR: #000000;
FONT-FAMILY: verdana, helvetica, sans-serif;
FONT-SIZE: 12px;
FONT-STYLE: normal;
border: 1 solid #000000;
}
Textarea
{
BACKGROUND-COLOR: #FFFFFF;
COLOR: #000000;
FONT-FAMILY: verdana, helvetica, sans-serif;
FONT-SIZE: 12px;
FONT-STYLE: normal;
border: 1 solid #000000;
}
-->
</style>
</head>
<body>
<%
strMode = Request.Querystring(\"mode\")
select case strMode
case \"id\"
Response.Buffer = True
\' Her opdateres hits når brugeren bliver sendt til et link
Set myConn = Server.CreateObject(\"ADODB.Connection\")
myConn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & Server.MapPath(\"links.mdb\")
If Request.QueryString(\"id\") <> \"\" Then
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT * FROM links WHERE (ID = \" & Request.QueryString(\"id\") & \")\"
rs.Open strSQL, myConn, 1, 3
If Not (rs.BOF Or rs.EOF) Then
rs(\"Hits\") = rs(\"Hits\") + 1
strURL = rs(\"URL\")
rs.Update
rs.Close
myConn.Close
Set rs = Nothing
Set myConn = Nothing
Response.Clear
Response.Redirect(strURL)
End If
End If
%>
<% case \"search\"
\' Siden med søgeresultater
\' Database connection
Set myConn = Server.CreateObject(\"ADODB.Connection\")
myConn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & Server.MapPath(\"links.mdb\")
\' Henter søgeorden fra formularen
strKeyword = Trim(Request.Form(\"søgeord\"))
If Len(strKeyword) = 0 Then
\' Hvis der ikke er skrevet i formularen sendes brugeren tilbage
Response.Clear
Response.Redirect (\"links.asp?mode=søg\")
Else
strKeyword = Replace(strKeyword,\"\'\",\"\'\'\")
End If
\' Opbygger en dynamisk SQL streng
strSQL = \"SELECT id, navn, url, beskrivelse, hits, søgeord FROM links WHERE\"
strSQL = strSQL & \" (id LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (navn LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (url LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (beskrivelse LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (hits LIKE \'%\" & strKeyword & \"%\')\"
strSQL = strSQL & \" OR (søgeord LIKE \'%\" & strKeyword & \"%\')\"
\' Skaber et recordset udfra SQL strengen
Set rs = myConn.Execute(strSQL)
If Not (rs.BOF Or rs.EOF) Then
\' Hvis søgningen gav resultat
Response.Write \"<table width=\'450\' cellspacing=1 cellpadding=1 style=\'border-bottom: 1 solid #C0C0C0\'>\"
Response.Write \"<tr><td align=center width=\'100%\' colspan=2><font size=2><b>Søgeresultater for \" & strKeyword & \"</b></font></td></tr>\"
Do While Not rs.EOF
Response.Write \"<tr><td valign=top width=\'100%\' colspan=2 bgcolor=#979797><font size=2><b><a href=links.asp?mode=id&id=\" & rs(\"ID\") & \"> \" & rs(\"Navn\") & \"</b></font></a></td></tr>\"
Response.Write \"<tr><td valign=top width=\'80%\' bgcolor=#efefef><font size=2>\" & rs(\"Beskrivelse\") & \"</font></a></td>\"
Response.Write \"<td valign=top width=\'20%\' bgcolor=#e5e5e5><font size=2> Hits: \" & rs(\"Hits\") & \"</font></td></tr>\"
Response.Write \"<tr><td width=\'100%\' colspan=2 bgcolor=#efefef> </td></tr>\"
rs.MoveNext
Loop
Response.Write \"<tr><td width=\'100%\' colspan=2 align=right style=\'border-top: 1 solid #C0C0C0\'><font size=\'2\'><a href=\'links.asp\'>Links</a> | <a href=\'links.asp?mode=søg\'>Søg igen</a> | <a href=\'links.asp?mode=add\'>Tilføj links</a></font></td></tr>\"
Response.Write \"</table><br><br>\"
Else
\' Hvis ingen poster passede på søgordene
Response.Write \"<table width=\'450\' cellspacing=1 cellpadding=1 style=\'border-bottom: 1 solid #C0C0C0\'>\"
Response.Write \"<tr><td align=center width=\'100%\'><font size=2>Søgeresultater for \" & strKeyword & \"</font></td></tr>\"
Response.Write \"<tr><td align=center width=\'100%\' bgcolor=#e5e5e5><font size=2>Ingen sider passede på søgeordet</font></a></td></tr>\"
Response.Write \"<tr><td width=\'100%\' colspan=2 align=right style=\'border-top: 1 solid #C0C0C0\'><font size=\'2\'><a href=\'links.asp\'>Links</a> | <a href=\'links.asp?mode=søg\'>Søg igen</a> | <a href=\'links.asp?mode=add\'>Tilføj links</a></font></td></tr></table><br><br>\"
End If %>
<% case \"søg\"
\' Søgeformularen
Response.write \"<table width=\'450\' style=\'border-bottom: 1 solid #C0C0C0\'><tr><td><font size=\'2\'><b>Søg</b></font></td></tr>\"
Response.write \"<tr><td><form method=POST action=links.asp?mode=search><input type=text name=søgeord size=30></td></tr>\"
Response.write \"<tr><td><input type=submit value=\' søg \' name=send> <input type=button onclick=\'history.go(-1)\' value=tilbage name=tilbage></td></tr>\"
Response.Write \"<tr><td width=\'100%\' align=right style=\'border-top: 1 solid #C0C0C0\'><font size=\'2\'><a href=\'links.asp\'>Links</a> | <a href=\'links.asp?mode=add\'>Tilføj links</a></font></td></tr></table></form>\"
%>
<% case \"update\"
\' Sender resultaterne fra tilføj links til databasen
\' Database connection
Set Conn = Server.CreateObject(\"ADODB.Connection\")
Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & server.MapPath(\"links.mdb\")
\' Opbygger SQL streng
SQLstmt = \"INSERT INTO links (navn,url,beskrivelse,hits,søgeord,kategori,godkendt)\"
SQLstmt = SQLstmt & \" VALUES (\'\" & request.form(\"navn\") & \"\',\'\" & request.form(\"url\") & \"\',\'\" & request.form(\"beskrivelse\") & \"\',\'\" & request.form(\"hits\") & \"\',\'\" & request.form(\"søgeord\") & \"\',\'\" & request.form(\"kategori\") & \"\',\'nej\')\"
response.write sqlstmt
Conn.Execute (SQLstmt)
conn.Close
Set conn = nothing
Set SQLstmt = nothing
\' Sender brugeren tilbage til links når databasen er opdateret
response.redirect (\"links.asp\")
%>
<% case \"add\"
\' tilføj links
%>
<form method=\"POST\" action=\"links.asp?mode=update\">
<center><table border=\"1\" bordercolor=\"CC0000\" width=\"450\" cellpadding=\"3\" style=\'border-bottom: 1 solid #C0C0C0\'>
<tr><td colspan=\"2\"><font face=\"verdana\" size=\"2\"><b>Tilføj links</b></font></td></tr>
<tr>
<td width=\"35%\"><font face=\"Verdana\" size=\"2\"><b>Linkets navn</font></td>
<td width=\"65%\">
<p><input type=\"text\" name=\"navn\" size=\"32\"></p>
</td>
</tr>
<tr>
<td width=\"35%\"><font face=\"Verdana\" size=\"2\"><b>url</b></font></td>
<td width=\"65%\"><input type=\"text\" name=\"url\" value=\"http://\" size=\"32\"></td>
</tr>
<tr>
<td width=\"35%\" valign=\"top\"><font face=\"Verdana\" size=\"2\"><b>Kort beskrivelse</b></font></td>
<td width=\"65%\"><textarea name=\"beskrivelse\" cols=\"32\"></textarea></td>
</tr>
<tr>
<td width=\"35%\" valign=\"top\"><font face=\"Verdana\" size=\"2\"><b>Kategori</b></font></td>
<td width=\"65%\"><select name=\"kategori\">
<%
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT * FROM kategorier ORDER BY kategori\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"links.mdb\")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
Do until rs.EOF = True
Response.Write \"<option value=\'\" & rs(\"kategori\") & \"\'>\" & rs(\"kategori\") & vbCrLf
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
%></select></td>
</tr>
<tr>
<td width=\"35%\" valign=\"top\"><font face=\"Verdana\" size=\"2\"><b>Søgeord</b><br>Adskilles med komma!</font></td>
<td width=\"65%\"><input type=\"text\" name=\"søgeord\" size=\"32\"></td>
</tr>
<tr>
<td width=\"100%\" colspan=\"2\"><input type=\"hidden\" value=\"0\" name=\"hits\"><input type=\"submit\" value=\"Send\" name=\"send\">
<input type=\"reset\" value=\"Annuller\" name=\"anuller\"> <input type=\"button\" onclick=\"history.go(-1)\" value=\"Tilbage\" name=\"Tilbage\"></td>
</tr>
<tr><td width=\'100%\' colspan=2 align=right style=\'border-top: 1 solid #C0C0C0\'><font size=\'2\'><a href=\'links.asp\'>Links</a> | <a href=\'links.asp?mode=søg\'>Søg i links</a></font></td></tr></table></center>
</form>
<% case \"vis\"
\' Hvis der ikke er valgt noget mode vises alle links
\' Paging
intPage = Request(\"page\")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
End If
\' Database connection
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT * FROM links WHERE kategori=\'\" & request(\"kat\") & \"\' AND godkendt=\'ja\' ORDER BY navn\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"links.mdb\")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
rs.PageSize = 10
rs.AbsolutePage = intPage
intRecCount = rs.PageSize
intPageCount = rs.PageCount
Response.Write \"<table width=\'450\' cellspacing=\'2\' cellpadding=\'0\'>\"
Do While Not rs.EOF And intRecCount > 0
Response.Write \"<tr><td valign=top width=\'100%\' colspan=2 bgcolor=#808080><font size=2><b><a href=links.asp?mode=id&id=\" & rs(\"ID\") & \">\" & rs(\"Navn\") & \"</a></b></font></td></tr>\"
Response.Write \"<tr><td valign=top width=\'80%\' bgcolor=#efefef><font size=2>\" & rs(\"Beskrivelse\") & \"</font></a></td>\"
Response.Write \"<td valign=top width=\'20%\' bgcolor=#e5e5e5><font size=2> Hits: \" & rs(\"Hits\") & \"</font></td></tr>\"
Response.Write \"<tr><td width=\'100%\' colspan=2 bgcolor=#efefef> </td></tr>\"
intRecCount = intRecCount - 1
rs.MoveNext
Loop
End If
Response.Write \"</table>\"
rs.Close
Set rs = Nothing
\' Navigering mellem siderne med paging
Response.Write \"<table width=\'450\' style=\'border-top: 1 solid #C0C0C0;border-bottom: 1 solid #C0C0C0\'><tr>\"
If Clng(intPage) > 1 Then
Response.Write \"<td><font size=\'2\'><a href=links.asp?page=\" & intPage - 1 & \" class=paging>[<<]</a></td>\"
Else
Response.Write \"<td></td>\"
End If
Response.Write \"\"
For intNum = 1 To intPageCount
Response.Write \"<td valign=\'top\'><font size=\'2\'><a href=links.asp?page=\" & intNum & \">\" & intNum & \"</a></font></td> \"
Next
If Clng(intPage) < Clng(intPageCount) Then
Response.Write \"<td><font size=\'2\'><a href=links.asp?page=\" & intPage + 1 & \" class=paging>[>>]</a></td>\"
Else
Response.Write \"<td></td>\"
End If
Response.write \"<td><font size=\'2\'>Side <b>\" & intPage & \"</b> af \" & intPageCount & \"</font></td><td><p align=\'right\'><font size=\'2\'><a href=\'links.asp\'>Oversigt</a> | <a href=\'links.asp?mode=søg\'>Søg i links</a> | <a href=\'links.asp?mode=add\'>Tilføj links</a></font></p></td></tr></table>\"
case else
\' Database connection
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT * FROM kategorier ORDER BY kategori\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"links.mdb\")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
Response.Write \"<center><table width=\'300\' cellspacing=\'2\' cellpadding=\'0\'>\"
Do until rs.EOF = True
Response.Write \"<tr><td width=\'100%\' colspan=2 bgcolor=#808080><center><a href=\'links.asp?mode=vis&kat=\" & rs(\"kategori\") & \"\'>\" & rs(\"kategori\") & \"</a></center></td></tr>\"
rs.MoveNext
Loop
End If
Response.Write \"</table></center>\"
rs.Close
Set rs = Nothing
end select %>
</body>
</html>