Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    cant press the enter

    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?



    <html>

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

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


    <table WIDTH="96%" BORDER="0" CELLSPACING="5" CELLPADDING="5">
    <tr>
    <td WIDTH="100%"><font FACE="ARIEL,HELVETICA" SIZE="-1"><p align="center"><script
    LANGUAGE="JavaScript">

    <!-- 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='toolbar=no,location=no,directories=no,status=no,menubar=no,height=400,width=300,'
    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>")

    }
    }
    if(!Found)
    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>
    <br>
    </font>
    </p>
    </center></div>
    </form>
    </td>
    </tr>
    </table>
    <!--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>

    </body>
    </html>

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Ames, IA, USA
    Posts
    373
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Code:
    <form name="form1" onsubmit="checkDatabase()">
    Need more emoticons?
    Visit Catman's Private Stock

  • #3
    New to the CF scene
    Join Date
    Sep 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Ames, IA, USA
    Posts
    373
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try removing the target attribute from your base element.
    Need more emoticons?
    Visit Catman's Private Stock


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •