søgning
Jeg har et lille problem med et søgescript..der er inkluderet en dropdown med søgekriterier, problemet er nu at optimere søgningen,der er et problem med f.eks netværk og kabinetter, søgningen kører på net d.v.s hvis man søger kategorien netværk, vises kabinetter også, jeg vil hører om nogen har en ide at definere søgningen til e.v.t. de 4 første karakterer....her er scriptet<html>
<head>
<meta NAME=\"Generator\" CONTENT=\"Stone\'s WebWriter 3\">
<link REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"style.css\">
<!-- Minus AutoDato -->
<title>Search 2a-2</title>
<script language=\"JavaScript\">
<!--
function co(element,mode) {
if (mode==\"in\") {
cursortype = \'default\'
colorval = \'#FFD700\'
} else if (mode==\"out\") {
cursortype = \'\'
colorval = \'#FFFFEB\'
}
element.style.background=colorval;
element.style.cursor=cursortype;
}
// -->
</script>
<style TYPE=\"text/css\">
</style>
</head>
<body TOPMARGIN=\"3\" LEFTMARGIN=\"0\" bgcolor=\"#ededf0\">
<%
strAction = Request(\"action\")
If strAction = \"\" Then
%>
<form action=\"search2a-2.asp\" method=\"get\" target=\"indhold\">
<input type=\"hidden\" name=\"action\" value=\"search2a-2\">
<center><table BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\">
<tr>
<td><select name=\"soeg\" size=\"1\" class=\"text-search-input\"><option selected value>---Vælg produkt---
<option value=\"cd-\">CD
<option value=\"cdrw\">CD-brænder
<option value=\"con\">Controllere
<option value=\"dvd-\">DVD
<option value=\"gr-\">Grafikkort
<option value=\"hdd-\">Harddiske
<option value=\"spk-\">Højtalere
<option value=\"kabel\">Kabler
<option value=\"kabinet\">Kabinetter
<option value=\"lyd-\">Lydkort
<option value=\"mon-\">Monitor
<option value=\"mod-\">Modem
<option value=\"mb-\">Motherboard
<option value=\"mus-\">Mus
<option value=\"mul-\">Multimedie
<option value=\"net-\">Netværk
<option value=\"cpu-\">Processor
<option value=\"ram-\">Ram
<option value=\"sca-\">Scanner
<option value=\"sft-\">Software
<option value=\"psu-\">Strømforsyning
<option value=\"tas-\">Tastatur
<option value=\"ups-\">UPS
<b class=\"text-search\"></b> <input type=\"submit\" name=\"submit\" value=\"OK\" class=\"text-search\"></td>
</tr>
</table></center>
</form>
<%
ElseIf strAction = \"search2a-2\" Then
strQuery = Request(\"soeg\")
If strQuery > \"\" then
Set DB = Server.CreateObject(\"ADODB.Connection\")
DB.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & Server.Mappath(\"../vare/db1.mdb\")
SQL = \"SELECT * FROM LAGERASP WHERE Varenummer LIKE \'%\" & strQuery & \"%\' OR Varenavn1 LIKE \'%\" & strQuery & \"%\' OR Varenavn2 LIKE \'%\" & strQuery & \"%\';\"
Set rs = db.Execute(SQL)
Response.Write \"<FORM>\"
If not rs.BOF then
Response.Write \"<CENTER>\"
Response.Write \"<table border=0 width=612 height=1 bgcolor=#000000 cellspacing=0 cellpadding=0><tr><td></td></tr></table>\"
Response.Write \"<table border=0 height=20 width=612 cellspacing=0 cellpadding=0 bgcolor=#000000>\"
Response.Write \"<tr><td width=1 id=black></td><td width=10></td><td width=140><b class=\'text-hl\'>VARENUMMER</b></td><td width=5></td><td width=170><b class=\'text-hl\'>VARENAVN</b></td><td width=20></td><td width=120><b class=\'text-hl\'>BEMÆRKNING</b></td><td width=5></td><td width=30><b class=\'text-hl\'>ANTAL</b></td><td width=5></td><td width=22></td><td width=63 align=right><b class=\'text-hl\'>PRIS</b></td><td width=15></td><td width=1 bgcolor=#000000></td></tr>\"
Response.Write \"</table>\"
Response.Write \"</CENTER>\"
Do until rs.eof
vkPriceVar = Replace(rs(\"Pris\"), \",\", \".\")
vkPriceVar = Replace(LCase(vkPriceVar), \"kr\", \"\")
vkPriceVar = Replace(vkPriceVar, \" \", \"\")
Response.Write \"<CENTER>\"
Response.Write \"<table border=0 width=612 height=1 id=black cellspacing=0 cellpadding=0><tr><td></td></tr></table>\"
Response.Write \"<table border=0 id=table-bg height=20 width=612 cellspacing=0 cellpadding=0 onmouseover=co(this,\'in\'); onmouseout=co(this,\'out\');>\"
Response.Write \"<tr><td width=1 height=20 id=black></td><td width=10></td><td width=137><b class=\'text-vn\'>\" & rs(\"Varenummer\") & \"</A></b></td><td width=5></td><td width=175><b class=\'text\'>\" & rs(\"Varenavn1\") & \"</b></td><td width=14></td><td width=125><b class=\'text\'>\" & rs(\"Varenavn2\") & \"</b></td><td width=4></td><td width=25 align=left><b class=\'text-vn\'>\" & rs(\"Antal\") & \"</b></td><td width=5></td><td width=32 align=center><SCRIPT type=\'text/javascript\'>parent.vareFelt(document,\'\" & rs(\"Varenummer\") &\"\', \" & vkPriceVar &\", \'text\', \'parent.liste.location.reload()\')</SCRIPT></td><td width=63 class=text align=right>\" & rs(\"Pris\") & \"</td><td width=15></td><td width=1 height=20 bgcolor=#000000></td></tr>\"
Response.Write \"</table>\"
Response.Write \"</CENTER>\"
rs.movenext
Loop
Response.Write \"</FORM>\"
Response.Write \"<CENTER>\"
Response.Write \"<table border=0 width=612 height=1 bgcolor=#000000 cellspacing=0 cellpadding=0><tr><td></td></tr></table>\"
Response.Write \"</CENTER>\"
Else
Response.Write \"<CENTER>\"
Response.Write \"<table border=0 width=400 height=30 cellspacing=0 cellpadding=0 id=\'td-bg\'>\"
Response.Write \"<tr><td valign=middle align=center><b class=\'text-none\'>Der var intet der matchede dine søgekriterier!</b></td></tr>\"
Response.Write \"</table>\"
Response.Write \"</CENTER>\"
End if
Else
Response.Write \"<CENTER>\"
Response.Write \"<table border=0 width=400 height=30 cellspacing=0 cellpadding=0 id=\'td-bg\'>\"
Response.Write \"<tr><td valign=middle align=center><b class=\'text-none\'>Du skal indtaste noget!</b></td></tr>\"
Response.Write \"</table>\"
Response.Write \"</CENTER>\"
End if
Response.Write \"<BR>\"
Response.Write \"<CENTER>\"
Response.Write \"<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD CLASS=copyright>Copyright © <A HREF=\'mailto:info@proparts.dk\' TARGET=\'_new\' OnFocus=\'this.blur()\' CLASS=copyright-link>ProParts</A> 2001</TD></TR></TABLE>\"
Response.Write \"</CENTER>\"
set db = Nothing
End If
%>
</body>
</html>