Ir ao conteúdo
  • Cadastre-se

Como colocar um campo de "Busca" interna no site?


LeandroMdL

Posts recomendados

  • 2 anos depois...
Bom dia!!!

Alguém saberia me dizer o q devo fazer para criar um campo de "Busca" interna em minha home page?

Desde já, muito obrigado!!!

Primeiro, você coloca seu site no google:

http://www.google.com.br/addurl/

depois, você entra nas ferramentas para webmasters e manda verificar o seu site do jeito que ele mandar.

se você tiver um feed rss, você pode mandar como sitemap, que é mais fácil de enviar o seu conteudo...

aí você cria uma pesquisa personalizada:

http://www.google.com.br/coop/cse/

espere uns 5 dias (ou menos) e já funciona...

mas se você usar um CMS, tipo wordpress, joomla ou mambo, você pode usar o sistema de buscas deles mesmos...

Link para o comentário
Compartilhar em outros sites

  • 3 anos depois...

Tenho aqui esse código que funciona com java scrapt. Mais ele não visualiza imagens, apenas texto. Se alguem conseguir alteralo para que possa buscar por imagens com links desde já agradeço...

(HTML)...

<html>

<head>

<title>Untitled Page</title>

<style type="text/css">

body

{

background-color: #FFFFFF;

color: #000000;

}

</style>

<script type="text/javascript" src="./jquery-1.4.2.min.js"></script>

<script type="text/javascript" src="./searchindex.js"></script>

<script type="text/javascript">

<!--

var features = 'toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=no,left=,top=,width=,height=';

var searchDatabase = new SearchDatabase();

searchResults_length = 0;

var searchResults = new Object();

function searchPage(features)

{

var element = document.getElementById('SiteSearch1_keyword');

if ((element.value.length != 0) || (element.value != " "))

{

keywordVal = unescape(element.value);

keywordVal = keywordVal.toLowerCase();

searchResults_length = 0;

for (i=0; i<database_length; i++)

{

words = (searchDatabase.title + " " + searchDatabase.description + " " + searchDatabase.keywords).toLowerCase();

if (words.indexOf(keywordVal) != -1)

{

searchResults[searchResults_length++] = searchDatabase;

}

}

wndResults = window.open('about:blank', '', features);

setTimeout(function()

{

var results = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Search results</title></head>';

results = results + '<body style="background-color:#FFFFFF">';

results = results + '<span style="font-family:Arial;font-size:13px;color:#000000">';

for (n=0; n<searchResults_length; n++)

{

results = results + '<b><a style="color:#0000FF" target="_parent" href="'+searchResults[n].url+'">'+searchResults[n].title +'</a></b><br>Description:' + searchResults[n].description + '<br>Keywords:' + searchResults[n].keywords +'<br><br>\n';

}

if ((searchResults_length == 0))

{

results = results + 'No results';

}

results = results + '</span>';

results = results + '</body></html>';

wndResults.document.write(results);

},100);

}

return false;

}

// -->

</script>

<script type="text/javascript">

$(document).ready(function()

{

var $search = $('#SiteSearch1_form');

var $searchInput = $search.find('input');

var $searchLabel = $search.find('label');

if ($searchInput.val())

{

$searchLabel.hide();

}

$searchInput.focus(function()

{

$searchLabel.hide();

}).blur(function()

{

if (this.value == '')

{

$searchLabel.show();

}

});

$searchLabel.click(function()

{

$searchInput.trigger('focus');

});

});

</script>

</head>

<body>

<div id="wb_SiteSearch1" style="margin:0;padding:0;position:absolute;left:6px;top:9px;width:237px;height:18px;text-align:left;z-index:0;">

<form name="SiteSearch1_form" id="SiteSearch1_form" onsubmit="return searchPage(features)">

<input type="text" id="SiteSearch1_keyword" style="position:absolute;left:0px;top:0px;width:237px;height:18px;border:1px #C0C0C0 solid;font-family:Arial;font-size:13px;" name="SiteSearch1" value=""><label style="position:absolute;left:3px;top:1px;color:#C0C0C0;cursor:text;font-family:Arial;font-size:13px;" for="SiteSearch1_keyword"></label>

</form>

</div>

<button id="AdvancedButton1" type="button" onclick="searchPage ()" name="" value="" style="position:absolute;left:256px;top:0px;width:69px;height:39px;z-index:1;background-image:url(images/botao.png)"><div> </div></button>

</body>

</html>

(java scrapt)

var database_length = 0;

function SearchPage(url, title, keywords, description)

{

this.url = url;

this.title = title;

this.keywords = keywords;

this.description = description;

return this;

}

function SearchDatabase()

{

database_length = 0;

this[database_length++] = new SearchPage("index.html", "Untitled Page", "untitled page nbsp ", "");

return this;

}

salve este como (.js)

Para que funcione, baixe um arquivo chamado jquery-1.4.2.min Aqui está o link http://www.4shared.com/document/yBpBIHhr/jquery-142min.html

Um forte abraço!

Link para o comentário
Compartilhar em outros sites

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...