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

    problema codice motore di ricerca interno

    ciao a tutti

    ho la necessità di creare un motore di ricerca interno per il mio sito e cercando in internet, in particolare sul sito WEBLINK ho trovato questo codice:

    Codice PHP:
    <script  LANGUAGE="JavaScript" type="text/javascript">
    <!--  
    prelevato ed illustrato su web-link.it

        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] =5

    // 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] = "editor"
    Descrip[1] = "editor html"
    Address[1] = "2html.htm"

    Keyword[2] = "editor"
    Descrip[2] = "editor css"
    Address[2] = "2css.htm"

    Keyword[3] = "java"
    Descrip[3] = "effetti speciali con java"
    Address[3] = "2java.htm"

    Keyword[4] = "javascript"
    Descrip[4] = "effetti speciali con javascript"
    Address[4] = "2js.htm"

        
    function checkDatabase() {

          var 
    Found false
          
    var Item document.forms.ricerca.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>Script su scripting di WebLinkRisultati della ricerca<\/title><\/head>");
    MsgBox.document.write ("<body bgcolor=#ffffff text=#000099 link=green vlink=orange alink=yellow><CENTER><H3><font face=Verdana>Risultati della ricerca<\/H3>"
    MsgBox.document.write ("<font size=3><center>Per la parola chiave:
    [B]  "
    +Item+"<\/B><\/center><hr width=50%><\/font><\/CENTER>");
            for (var 
    i=1<= Keyword[0]; i++) {
            if(
    Item == Keyword[i]) {
              
    Found true;
             
    MsgBox.document.write ("[*]<font face=arial><font size=2>"+Descrip[i]+"
    <A HREF="
    +Address[i]+" target='opener'>questo il link per richiamare la pagina<\/A><\/font><\/font>"

            }
          }
          if(!
    Found)
    MsgBox.document.write ("<font color=red><H4>Nessuna corrispondenza trovata, riprova con altra parola o sinonimo<\/H4><\/font>")

    // 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 ("<\/form>")
    MsgBox.document.write ("<font face=arial size=1 color=black>Originally created by Adam Allen 
    © 1997 All Rights Reserved<\/font><\/center>"
    )
    // 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.
         
    }
    /* prelevato su web-link: [url]http://www.web-link.it[/url] */
    //    --> 
    </script> 
    solamente che ho un problema: in questo codice, una volta sistemato, quando si digita una parola per la ricerca appare una finestra, un pop out con il tasto "clicca per visualizzare la pagina" e il problema è proprio questo! io vorrei che quando un utente digiti una parola (che assegnerò io fra altre) venga subito indirizzato al link della pagina senza che appaiano finestre....come devo modificare il codice trovato??

  2. #2
    Non mi pare un problema legato all'html, ma al javascript (c'è un forum apposito con gente preparata sull'argomento).

    Riguardo all'html, anche se non è quello che ti da' i problemi, andrebbe rivisto tutto in quanto usa tag deprecati e sintassi un po' vecchiotta.
    Fantasupermegafavolipermeramagicultra irresistibili
    4 10 30 100 1001 personaggi insuperabili fantaincredibili ultraimpossibili iperterribili irresistibili!!!

    "... a quell'età ... bastava un dito per fare la pace ..."
    fotine

  3. #3
    Amministratore L'avatar di Vincent.Zeno
    Registrato dal
    May 2003
    residenza
    Emilia-Romagna (tortellini und cappelletti land!)
    Messaggi
    20,781
    intanto sposto su JS...

  4. #4
    Rabbrividisco a vedere un orrore di codice come quello, ma insomma se a te piace ok.
    Facci sapere se così va bene, ad ogni modo è un codice che non aggiunge alcun valore reale al tuo sito: praticamente se un utente digita alcune parole predefinite in un campo di testo produce una manciata di link: fai prima a fargli una paginetta con i link, una ancora con un testo descrittivo è molto meglio che questa spaghettata.
    codice:
    <script>
    
    
        Keyword = new Object();
        Descrip = new Object();
        Address = new Object();
    
    Keyword[0] =5
    
    Keyword[1] = "editor"
    Descrip[1] = "editor html"
    Address[1] = "2html.htm"
    
    Keyword[2] = "editor"
    Descrip[2] = "editor css"
    Address[2] = "2css.htm"
    
    Keyword[3] = "java"
    Descrip[3] = "effetti speciali con java"
    Address[3] = "2java.htm"
    
    Keyword[4] = "javascript"
    Descrip[4] = "effetti speciali con javascript"
    Address[4] = "2js.htm"
    
        function checkDatabase() {
    
          var Found = false
          var Item = document.forms.ricerca.searchfor.value.toLowerCase();
    
            for (var i=1; i <= Keyword[0]; i++) {
            if(Item == Keyword[i]) {
              Found = Address[i]; 
            }
          }
          if(Found){location.href=Found;}
         }
    
    </script>
    
    <body><form name="ricerca">
    <input name='searchfor'></form>
    
    testiamo questo motore di ricerca...
    </body>

  5. #5
    grazie mille TrueLies per il codice postato!
    grazie per il tuo valido aiuto (premetto che non sono esperto di html vorrei solo creare un mio sito semplicissimo quindi scusate se faccio errori ecc)
    comunque grazie a tutti mi siete stati d'aiuto


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.