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

    MOTORE di ricerca INTERNO

    1 Ho un problema ! Stò provando a crare un motore di ricerca interno per il mio sito ! Non mi intendo molto di Javascript e quindi mi capita molto spesso di ricorrere a manuali ON LINE ! Questo Javascript è di Pasquale Annunziata e lo ho preso da HTML . IT ! Funzionava correttamente fino a quando non mi è venuto in mente di modificarlo in base alle mie esigenze ! Qualcosa non torna quando premo SEARCH ! Purtroppo si verifica un errore nella riga 15 ( Internet Explorer : 'key' non è definito / Mozilla Firefox : key is not defined riga 14 )
    ______FORM________________________________________ _
    <FORM name="searchform">
    <TABLE align="center" border="1" cellpadding="5">
    <TR align="center" bgcolor="#999999">
    <TD align="center" colspan="1">
    <INPUT type="text" name="searchwords" value="" size="50">
    </TD>
    </TR>
    <TR align="center" bgcolor="#999999">
    <TD align="center">
    <INPUT type="submit" name="startsearch" value="SEARCH" style="font-size:10px" onClick="searchAll(this.form.searchwords.value.toL owerCase())">
    <INPUT type="reset" name="reset" value="RESET" style="font-size:10px">
    <INPUT type="button" name="" value="CLOSE" style="font-size:10px" onClick='self.close()'>
    </TD>
    </TR>
    </TABLE>
    </FORM>
    _______JAVASCRIPT_________________________________ ______
    <!--
    // Script Author - Pasquale Annunziata
    //e - mail : mc0414@mclink.it
    Aut="P.Annunziata";
    function makeArray(n) {
    this.length = n;
    for (var k = 1; k <= n; k++) {
    this[k] = "";
    }
    return this;
    }
    //ora inseriamo le specifiche delle funzioni di ricerca
    function stripInput(Key) {
    while(key.substring(0,1) == "," || key.substring(0,1) == " " || key.substring(0,1) == "" ) {
    key = key.substring(1,key.length);}
    while(key.substring(key.length-1,key.length) == "," || key.substring(key.length-1,key.length) == " " || key.substring(key.length-1,key.length) == "") { key = key.substring(0,key.length-1);}
    return key;
    }
    function parseIt(key) {
    key = stripInput(key);
    key+=",";
    var y = 1;
    while(key.indexOf(",") > 0) {
    var pos = key.indexOf(",");
    keywords[y]=key.substring(0,pos);
    keywords[y]=stripInput(keywords[y]);
    //alert(keywords[y]);
    y++;
    if(y > 11) {
    writeOutput("<BODY bgcolor='WHITE' text='BLACK'>810H4Z4RD CRAWLER ESEGUE UNA RICERCA UTILIZZANDO UN MASSIMO DI PAROLE ALLA VOLTA</BODY>");
    return -1;}
    key=key.substring(pos+1,key.length);}
    return y-1;
    }
    var keywords = new makeArray(11);
    //initialize search keyword array
    function clearSearch(form) {
    for(var x=1;x <= 11; x++) {
    keywords[x]=""; }
    }
    function writeOutput(outString) {
    parent.output.document.open();
    parent.output.document.write(outString);
    parent.output.document.close();
    }
    function dataEntry (){
    this.v1= "";
    this.v2="";
    return this;
    }
    function makeRecordLinks(size) {
    thise.length = size;
    for (var r=1; r<= size; r++) {
    this[r] = new dataEntry();
    this[r].v1= v1[r];
    this[r].v2 = v2[r]; }
    return this; }
    function searchAll(keyword) {
    var nw=1;
    clearSearch(document.searchform);
    var x = parseIt(keyword);
    if(x == -1) { //abort on failed parse
    return;}
    if(keyword =="" || keyword.length <2) {
    writeOutput("<BODY bgcolor='WHITE' text='BLACK'><FONT face='Arial'>810H4Z4RD CRAWLER NON RICERCA UTILIZZANDO LE PAROLE APPENA DIGITATE</FONT>");
    return; }
    parent.output.document.open();
    parent.output.document.clear();
    parent.document.close();
    while(keyword[nw].length > 1) {
    search(new makeRecordLinks(records_count),keywords[nw]);
    nw++;}
    if (navigator.appName != "Netscape"){
    parent.output.document.close();}
    }
    function printRecords(records,q) {
    while(Aut!="P.Annunziata") {};
    parent.output.document.write("<TR><TD>" + records[q].v1 + "</TD></TR>");
    }
    function search(records, keyword) {
    var rec_number=0;
    var hit=0;
    var finds=0;
    parent.output.document.write("<BODY bgcolor='WHITE' text='BLACK'>");
    parent.output.document.write("<FONT face='Arial'>LA RICERCA DELLE PAROLE PRECEDENTEMENTE SCELTE HANNO PRODOTTO COME RISULTATO FINALE</FONT> " +keyword +"");
    parent.output.document.write("<TABLE align='center' border='1' cellpadding='5'>");
    for (q=1; q<=records.length; q++) {
    search_parm=records[q].v2.toLowerCase();
    if (search_parm.indexOf(keyword) != -1) {
    hit++;finds++;
    if(hit < 2) {
    printRecords(records,q);
    }
    }
    //reset hit count for next search
    hit=0;
    } //closes the "for" loop
    parent.output.document.write("</TABLE>" +"
    ");
    }
    // SEZIONE DATI
    //definiamo le arrays dei dati
    var records_count=0;
    v1=new makeArray(records_count);
    v2 = new makeArray(records_count);
    var a=0;
    // DEFINIAMO LE PAGINE DA INSERIRE NEL DATABASE //
    a += 1
    v1[a] = "<FONT></FONT>"
    v2[a] = "CRACK CRACKER CRACKERS CRACKING SOCIAL ENGINEERING PASSWORD LOGIN"
    records_count = a;
    //end data
    //-->

    Non metto in dubbio che il POST è lunghissimo ma se proverete ad aiutarmi ne sarei sicuramente felice ! Grazie anticipate a tutti coloro che mi verranno incontro !

  2. #2
    Moderatore di JavaScript L'avatar di br1
    Registrato dal
    Jul 1999
    Messaggi
    19,998
    il javascript distingue maiuscole e minuscole... ha definito la variabile Key poi la utilizzi come key:

    function stripInput(Key) {
    while(key.substring(0,1)
    ...

    ciao
    Il guaio per i poveri computers e' che sono gli uomini a comandarli.

    Attenzione ai titoli delle discussioni: (ri)leggete il regolamento
    Consultate la discussione in rilievo: script / discussioni utili
    Usate la funzione di Ricerca del Forum

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.