Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Problema tabella e motore di ricerca

    Ho queta cella che contiene un motore di ricerca con javascript :

    codice:
    <td width="100%">
                          <script     LANGUAGE="JavaScript">
    
        <!-- Hide Script from Old Browsers
    /* 
    
            Optimized by Daniel Bergman [http://botw.cjb.net].
    
            Java Search Engine
            (c)1997 Adam ALLEN.
            Version 2.0
                    You may use this search engine on your page, but keep this 
                    notice intact, and at the bottom of leave the Copyright notice at
                    the bottom of this page.
                    This scripts is my property, so please honnour my requests,
                    If you do so, you may freely copy, distribute, give this scripts
                    But it will FOREVER REMAIN MY PROPERTY.
            This is the first Java Script that I have wrote, and am proud of it,
            I feel pleased that I can contribute back to the bank of JavaScripts
            that I have used on my page from other people, AN EYE FOR AN EYE!
    */
    
        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] = "javascript"
    Descrip[1] = "350 esempi javascript gratuiti"
    Address[1] = "http://www.html.it/jscript"
    
    Keyword[2] = "html"
    Descrip[2] = "La guida in italiano all'HTML"
    Address[2] = "http://www.html.it/guida"
    
    Keyword[3] = "applet"
    Descrip[3] = "Oltre 300 applet Java da scaricare"
    Address[3] = "http://www.html.it/java"
    
    Keyword[4] = "cgi"
    Descrip[4] = "Il punto di riferimento italiano sui CGI"
    Address[4] = "http://www.html.it/cgi"
    
        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=300,width=300,'
    stats += 'scrollbars=yes,resizable=yes' 
    MsgBox = window.open ("","msgWindow",stats) 
    MsgBox.opener = window;
    MsgBox.opener.name = "opener";
    MsgBox.document.write("<head><title>Risultati della ricerca</title></head>");
    MsgBox.document.write ("<body bgcolor=white text=black link=blue vlink=darkblue alink=blue><H2><CENTER><font face=arial>Risultati della ricerca</CENTER></H2>") 
    MsgBox.document.write ("<font size=3><center>Per il termine:  "+Item+"</center><hr width=50%></font>");
            for (var i=1; i <= Keyword[0]; i++) {
            if(Item == Keyword[i]) {
              Found = true;
             MsgBox.document.write ("[*]<font face=arial><font size=2>[b]"+Descrip[i]+"
    Clicca qui</font></font>") 
    
            }
          }
          if(!Found)
    MsgBox.document.write ("<H4>Nessun risultato</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='chiudi' onClick = 'self.close()'></font></font>") 
    MsgBox.document.write ("</CENTER></FORM>")
    MsgBox.document.write ("<H6><small><small><font color=white><font face=arial><font size=1><font color=black>Originally created by Adam Allen 
    © 1997 All Rights Reserved</font></font></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>
    
    <form NAME="form1">
    <p align="center">
    <input TYPE="text" NAME="searchfor" onClick="this.value='';" VALUE="termine" SIZE="20" style="border: 1 solid #333333">
    <input type="button" value="cerca" onClick="checkDatabase()";>
    
    </form>
    
    
                          </td>
    ho provato a scrivere nel text "javascript" e invece che cliccare "cerca" ho cliccato invio e mi fa un collegamento alla home del sito , ovvero dove c'è il motore di ricerca !

    Come mai ?

    Come faccio a impostare che cliccando "invio" inii la ricerca ?

    ciao e grazie !

  2. #2
    Utente bannato
    Registrato dal
    Apr 2003
    Messaggi
    1,119
    teoricamente sarebbe così:
    codice:
    onKeyPress="if (event.KeyCode==13) etc..."
    o almeno così mi hanno detto, ma non mi va...(13 è il codice ascii dell'invio)

  3. #3
    <form NAME="form1" onsubmit="checkDatabase()";>
    <p align="center">
    <input TYPE="text" NAME="searchfor" onClick="this.value='';" VALUE="termine" SIZE="20" style="border: 1 solid #333333">
    <input type="submit" value="cerca">

    </form>
    .:::Longu:::.

  4. #4
    Solo leggermente ot.
    Ma per i siti statici o quasi e relativamente poco complessi un motore di ricerca interno in java con tutte le applet risulta più efficiente di usare un servizio esterno come atoms o freefind? Nessuna applet java, traffico diviso tra motore e sito, personalizzazione completa, spidering periodico, risultati personalizzabili, inserimento agevole nella pagina, solo un copia incolla o al massimo un form. La vedo così. Anche se un po' di java ora si deve mettere per forza per il mancato supporto in xp.


    Me ne sono accorto dopo che era in javascript, solo che lo avevo letto java e applet solo che non era codice, lo so distratto assai.
    4 pag. x il forum:l'ospite ora ha solo link sponsorizzati, valli a capire-GommaLayout! Agg. 25 agosto 2004)-Molla&Collano privati tecnici, per favore

  5. #5
    Originariamente inviato da Longuflumini
    <form NAME="form1" onsubmit="checkDatabase()";>
    <p align="center">
    <input TYPE="text" NAME="searchfor" onClick="this.value='';" VALUE="termine" SIZE="20" style="border: 1 solid #333333">
    <input type="submit" value="cerca">

    </form>
    ok, va ma se clicco invio si mi avvia la ricerca ma nel iframe che c'è al centro della pagina mi compare la home del mio sito !!!

    Come mai ?
    Come faccio ad evitare ciò ?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.