Ir para conteúdo
Fórum Script Brasil
  • 0

Busca


Tarci

Pergunta

oiiiii

gostei muito da busca interna q tem aki nos scripts prontus, queria usar no meu site + quando fui aumentaar o num d buscas parou d funcionar

//aqui vai as entradas para a pesquisa

the_entries[0] = new entry ("http://www.clac4.kit.net", "[C4]", "joaohess, autor, webmaster, dono, desenvolvedor, contatos, icq, contato, parcerias ", "Site do Clan de Jogos em Rede e Internet, [C4]<br>");

the_entries[1] = new entry ("http://www.clac4.kit.net/links.htm","[C4]","WebMaster João Vitor", "[C4] ","[C4].<br>");

the_entries[2] = new entry ("http://www.clac4.kit.net/links.htm","[C4]","WebMaster João Vitor", "[C4] ","[C4].<br>");

the_entries[3] = new entry ("http://www.clac4.kit.net/links.htm","[C4]","WebMaster João Vitor", "[C4] ","[C4].<br>");

//abaixo vai o número de entradas existentes

var entry_num = 4; //aumenta de acordo com as obcoes de busca no caso 2 ate agora

var max_keywords = 40; //aumenta de acordo com as obcoes de busca no caso 2 ate agora

var points_title = 4; //aumenta de acordo com as obcoes de busca no caso 2 ate agora

var points_keywords = 4; //aumenta de acordo com as obcoes de busca no caso 2 ate agora

var points_description = 1;

begin_search ();

isso é 1 exemplo...eu fiz +ou- isso, só q adicionei +....

alguém sabe onde ttah o erro??? rolleyes.gif

Bjusss

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

  • 0

<BODY BGCOLOR=#000000 text="#00FF00" link="#00FFFF" vlink="#C0C0C0" alink="#00FFFF">

<form method="GET" action="resultado.html">

<p><font face="Arial" size="2">Busca por:</font><font face="Century Gothic" size="2"> <input type="text" name="query" size="20"><input type="submit" value="Buscar"></font></p>

</form>

<hr color="#00FF00">

<script>

function kw_list ()

{

this.keywords = new Array ();

this.num_words = 0;

this.query = "";

this.original_query = "";

this.query_length = 0;

this.possible_points = 0;

this.multiple = points_title + points_keywords + points_description;

this.get_words = get_query;

this.no_query = no_query_found;

}

function get_query ()

{

this.query = top.location.search.substring (top.location.search.indexOf ('=') + 1);

while ((the_plus = (this.query.indexOf ("+", 0))) != -1)

{

this.query_length = this.query.length;

this.query = this.query.substring (0, the_plus) + " " + this.query.substring (the_plus + 1);

}

this.original_query = unescape (this.query);

this.query = this.original_query.toLowerCase ();

this.query_length = this.query.length;

if (this.query != "")

{

var query_pointer = 0;

var end_word = 0;

var at_end = 0;

while ((this.num_words <= (max_keywords - 1)) && (! at_end))

{

end_word = this.query.indexOf (" ", query_pointer);

if (end_word == query_pointer)

query_pointer++;

else

{

if (end_word >= (this.query_length - 1))

at_end = 1;

if (end_word != -1)

this.keywords[this.num_words] = (this.query.substring (query_pointer, end_word)).toLowerCase ();

else

{

this.keywords[this.num_words] = this.query.substring (query_pointer, this.query_length);

at_end = 1;

}

this.num_words++;

if (query_pointer != -1)

query_pointer = end_word + 1;

if (query_pointer > (this.query_length - 1))

at_end = 1;

}

}

if (this.num_words == 0)

return (0);

else

{

this.possible_points = this.multiple * this.num_words;

return (1);

}

}

else

return (0);

}

function no_query_found ()

{

document.writeln ('<link rel="stylesheet" href="thf.css">');

document.writeln ('<CENTER><P><font size="2" face="Arial">Digite Algo no Campo de Busca</P></CENTER>');

}

function entry (url, title, keywords, description)

{

this.url = url;

this.title = title.toUpperCase();

this.keywords = keywords;

this.description = description;

this.points = 0;

this.search_entry = find_keyword;

this.print_entry = print_result;

}

function find_keyword (the_word)

{

var the_title = this.title.toLowerCase ();

var the_keywords = this.keywords.toLowerCase ();

var the_description = this.description.toLowerCase ();

if ((the_title.indexOf (the_word)) != -1)

this.points += points_title;

if ((the_keywords.indexOf (the_word)) != -1)

this.points += points_keywords;

if ((the_description.indexOf (the_word)) != -1)

this.points += points_description;

}

function print_result (possible_points)

{

document.writeln ('<FONT FACE="courier new"><A HREF="' + this.url + '">' + this.title + '</A><BR> - ' + this.description + '<BR><BR>');

}

function no_entry_printed (the_query)

{

document.writeln ('<link rel="stylesheet" href="thf.css">');

document.writeln ("<CENTER><P><class=tg> Não há ocorrencia da palavra <U><B>'" + the_query + "'</B></U>.</class=tg></P></CENTER>");

}

function print_intro (the_query)

{

document.writeln ('<link rel="stylesheet" href="thf.css">');

document.writeln ("<CENTER><P><class=tg>Os resultados da pesquisa por <U><B>'" + the_query + "'</B></U> são:</P></CENTER>");

}

function begin_search ()

{

var key_list = new kw_list;

var entry_printed = 0;

if (! key_list.get_words ())

key_list.no_query ();

else

{

var counter = 0;

var counter2 = 0;

for (counter = 0; counter < entry_num; counter++)

for (counter2 = 0; counter2 <= (key_list.num_words - 1); counter2++)

the_entries[counter].search_entry (key_list.keywords[counter2]);

for (counter = key_list.possible_points; counter > 0; counter--)

{

for (counter2 = 0; counter2 < entry_num; counter2++)

{

if (counter == the_entries[counter2].points)

{

if (entry_printed != 1)

{

entry_printed = 1;

print_intro (key_list.original_query);

}

the_entries[counter2].print_entry (key_list.possible_points);

}

}

}

if (! entry_printed)

no_entry_printed (key_list.original_query);

}

}

the_entries = new Array ();

// URL, Titulo, Palavra Chave, Descrição

the_entries[0] = new entry ("Site", "Titulo", "Palavra, chave, dividido, por, virgula", "Descrição");

// Configuração:

var entry_num = 1; // Digite o Maximo de ENTRIES + 1

var max_keywords = 20; // Maximo de Palavra Chave

var points_title = 3;

var points_keywords = 10;

var points_description = 1;

begin_search ();

</script>

<HR>

Ve ai! Ve as mini "estruções"

Link para o comentário
Compartilhar em outros sites

  • 0
<BODY BGCOLOR=#000000 text="#00FF00" link="#00FFFF" vlink="#C0C0C0" alink="#00FFFF">

<form method="GET" action="resultado.html">

<p><font face="Arial" size="2">Busca por:</font><font face="Century Gothic" size="2"> <input type="text" name="query" size="20"><input type="submit" value="Buscar"></font></p>

</form>

<hr color="#00FF00">

<script>

function kw_list ()

{

this.keywords = new Array ();

this.num_words = 0;

this.query = "";

this.original_query = "";

this.query_length = 0;

this.possible_points = 0;

this.multiple = points_title + points_keywords + points_description;

this.get_words = get_query;

this.no_query = no_query_found;

}

function get_query ()

{

this.query = top.location.search.substring (top.location.search.indexOf ('=') + 1);

while ((the_plus = (this.query.indexOf ("+", 0))) != -1)

{

this.query_length = this.query.length;

this.query = this.query.substring (0, the_plus) + " " + this.query.substring (the_plus + 1);

}

this.original_query = unescape (this.query);

this.query = this.original_query.toLowerCase ();

this.query_length = this.query.length;

if (this.query != "")

{

var query_pointer = 0;

var end_word = 0;

var at_end = 0;

while ((this.num_words <= (max_keywords - 1)) && (! at_end))

{

end_word = this.query.indexOf (" ", query_pointer);

if (end_word == query_pointer)

query_pointer++;

else

{

if (end_word >= (this.query_length - 1))

at_end = 1;

if (end_word != -1)

this.keywords[this.num_words] = (this.query.substring (query_pointer, end_word)).toLowerCase ();

else

{

this.keywords[this.num_words] = this.query.substring (query_pointer, this.query_length);

at_end = 1;

}

this.num_words++;

if (query_pointer != -1)

query_pointer = end_word + 1;

if (query_pointer > (this.query_length - 1))

at_end = 1;

}

}

if (this.num_words == 0)

return (0);

else

{

this.possible_points = this.multiple * this.num_words;

return (1);

}

}

else

return (0);

}

function no_query_found ()

{

document.writeln ('<link rel="stylesheet" href="thf.css">');

document.writeln ('<CENTER><P><font size="2" face="Arial">Digite Algo no Campo de Busca</P></CENTER>');

}

function entry (url, title, keywords, description)

{

this.url = url;

this.title = title.toUpperCase();

this.keywords = keywords;

this.description = description;

this.points = 0;

this.search_entry = find_keyword;

this.print_entry = print_result;

}

function find_keyword (the_word)

{

var the_title = this.title.toLowerCase ();

var the_keywords = this.keywords.toLowerCase ();

var the_description = this.description.toLowerCase ();

if ((the_title.indexOf (the_word)) != -1)

this.points += points_title;

if ((the_keywords.indexOf (the_word)) != -1)

this.points += points_keywords;

if ((the_description.indexOf (the_word)) != -1)

this.points += points_description;

}

function print_result (possible_points)

{

document.writeln ('<FONT FACE="courier new"><A HREF="' + this.url + '">' + this.title + '</A><BR> - ' + this.description + '<BR><BR>');

}

function no_entry_printed (the_query)

{

document.writeln ('<link rel="stylesheet" href="thf.css">');

document.writeln ("<CENTER><P><class=tg> Não há ocorrencia da palavra <U><B>'" + the_query + "'</B></U>.</class=tg></P></CENTER>");

}

function print_intro (the_query)

{

document.writeln ('<link rel="stylesheet" href="thf.css">');

document.writeln ("<CENTER><P><class=tg>Os resultados da pesquisa por <U><B>'" + the_query + "'</B></U> são:</P></CENTER>");

}

function begin_search ()

{

var key_list = new kw_list;

var entry_printed = 0;

if (! key_list.get_words ())

key_list.no_query ();

else

{

var counter = 0;

var counter2 = 0;

for (counter = 0; counter < entry_num; counter++)

for (counter2 = 0; counter2 <= (key_list.num_words - 1); counter2++)

the_entries[counter].search_entry (key_list.keywords[counter2]);

for (counter = key_list.possible_points; counter > 0; counter--)

{

for (counter2 = 0; counter2 < entry_num; counter2++)

{

if (counter == the_entries[counter2].points)

{

if (entry_printed != 1)

{

entry_printed = 1;

print_intro (key_list.original_query);

}

the_entries[counter2].print_entry (key_list.possible_points);

}

}

}

if (! entry_printed)

no_entry_printed (key_list.original_query);

}

}

the_entries = new Array ();

// URL, Titulo, Palavra Chave, Descrição

the_entries[0] = new entry ("Site", "Titulo", "Palavra, chave, dividido, por, virgula", "Descrição");

// Configuração:

var entry_num = 1; // Digite o Maximo de ENTRIES + 1

var max_keywords = 20; // Maximo de Palavra Chave

var points_title = 3;

var points_keywords = 10;

var points_description = 1;

begin_search ();

</script>

<HR>

Ve ai! Ve as mini "estruções"

Po!! desculpem-me ae...foi pura falta d atenção da minha parte, porque esqueci q os entries começam em 0 e acabava colocando os numeros errados!! unsure.gif

Agora aproveitando o tópico, hehehe...

assim eu queria por essa busca tipo no topo do site, e queria q o resultado aparecesse tipo num "MainFrame" ...deu pra entender?! Tem como fazer isso, e se sim, como? blink.gif heehee...

Valeeuuu...

Bjuuuu

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,5k
×
×
  • Criar Novo...