View Full Version : cant press the enter

09-24-2003, 03:17 PM
Who can help me. I've got this search script but there is one problem. I cant just press the enter button to get results. I MUST click on the button.

Who can help me out?


<title>Search </title>
<base target="leftframe">

<body BGCOLOR="#ffffff" link="#CC0033" vlink="#333399" alink="#FF0000" <!--content start-- -->

<td WIDTH="100%"><font FACE="ARIEL,HELVETICA" SIZE="-1"><p align="center"><script

<!-- Hide Script from Old Browsers

Redesign by -->Paul
Optimized by -->Daniel Bergman [http://botw.cjb.net].

original from-->Java Search Engine
(c)1997 Adam ALLEN.
Version 2.0


Keyword = new Object();
Descrip = new Object();
Address = new Object();

// Keyword[0] = n (where n is the number of keywords which can be searched
Keyword[0] = 6

// Each entry is split into
// Keyword[n] = text (where text is the keyword of which the entry is to
// be searched by (type Keywords in lowercase)
// Descrip[n] = text (where text is the description associated to this entry
// Address[n] = text (where text is the URL associated to the entry
// n is the entry number.

Keyword[1] = "test"
Descrip[1] = "URL naar een website."
Address[1] = "http://eenURLnaarWEBSITE.com"

Keyword[2] = "test"
Descrip[2] = "een url naar locale site"
Address[2] = "//URLnaarlocalesite"

Keyword[3] = "test"
Descrip[3] = "Click here to visit the Compaq site "
Address[3] = "http://URLnaarwebsite.nl"

Keyword[4] = "test"
Descrip[4] = "Your site can go here!"
Address[4] = "\\urlnaarlocalesite

function checkDatabase() {

var Found = false
var Item = document.forms[0].searchfor.value.toLowerCase();

stats += 'scrollbars=yes,resizable=yes'
MsgBox = window.open ("","msgWindow",stats)
MsgBox.opener = window;
MsgBox.opener.name = "opener";
MsgBox.document.write("<head><title>Search Results</title></head>");
MsgBox.document.write ("<body bgcolor=white text=black link=blue vlink=darkblue alink=blue><H2><CENTER><font face=arial>Search Results</CENTER></H2>")
MsgBox.document.write ("<font size=3><b><center>For the keyword: "+Item+"</center><hr width=50%></b></font>");
for (var i=1; i <= Keyword[0]; i++) {
if(Item == Keyword[i]) {
Found = true;
MsgBox.document.write ("<li><font face=arial><font size=2><b>"+Descrip[i]+"<BR><A HREF="+Address[i]+" target='opener'>Click Here To Go There</A></font></font>")

MsgBox.document.write ("<H4>Nothing Found</H4>")
// Leave the line below intact if you want to legally use this script
MsgBox.document.write ("<FORM><CENTER>")
MsgBox.document.write ("<font size=2><font color=arial><INPUT type='button' value='Close' onClick = 'self.close()'></font></font>")
MsgBox.document.write ("</CENTER></FORM>")
MsgBox.document.write ("<H6><small><small><small><b></b><font color=white><font face=arial><font size=1><font color=black>Designed by Paul </font></font></small></small></small>")
// There must be my notice above if you are to use this script legally.
// It took many hours work, fairs is fair, I just want that little line in
// and you get a fully working Search ENGINE, for FREE, on your site
// In Java Scripts as well, and not crap JAVA!
// Also a copyright notice MUST appear with the form.
// -->

</script> </p>
<form NAME="form1">
<b><div align="center"><center><p>Search for server name or IP adress:</b><br>
<input TYPE="text" NAME="searchfor" VALUE="" SIZE="20"><b><input type="button"
value="Search" align="absmiddle" onClick="checkDatabase()"></b><br>
<!--content stop-->
<p align="center"><font size="4"><u><i><b>NOTE:</b></i></u></font></p>
<p align="left"><img height="49" alt="amsterdam hotels" src="dutch_flag.jpg" width="72" border="0"></p>
<p align="left">Typ hier de naam van de server waar U naar op zoek bent en klik
daarna op de &search& knop. Let op: Men kan niet zomaar op de enter
knop drukken nadat U iets heeft ingetypt in het zoek veld, maar klik met Uw muis op de
Search knop. </p>
<p align="left"><img height="50" alt="English Flag" src="UKFL.jpg" width="70" border="0"></p>
<p align="left">Type here the name of the server you are looking for and click
on the &search& button. &please note that you can't just press
your enter button after you typed something in the search field, but specifically
press the search button.</p>


09-24-2003, 04:11 PM
A slight change to the form should do the trick. Remove the onclick event from the button and add an onsubmit event to the form tag.

<form name="form1" onsubmit="checkDatabase()">

09-24-2003, 04:41 PM
yes this is working. I just got another problem. If I press the enter button it shows the results BUT it also opens the search menu AGAIN

09-24-2003, 04:45 PM
Try removing the target attribute from your base element.