Como crear buscador para diferentes páginas web.
Encontré este código que no consigo que realice la búsqueda, algo tiene que estar mal, he intentado modificarlo sin suerte, si me puedes ayudar para que realice las búsquedas te lo agradecería, ya que presenta un menú muy práctico para seleccionar la página donde realizar las búsqueda.
El código es este:
<html>
<body>
<tr>
<td width="100%">
<p align="center"> </td>
</tr>
<tr>
<td width="100%"> </td>
</tr>
<tr>
<td width="100%" style="text-indent: 0" height="19">
<span lang="es">
<script>
<!--
function startSearch(){
searchString = document.searchForm.searchText.value;
if(searchString != ""){
searchEngine = document.searchForm.whichEngine.selectedIndex + 1;
finalSearchString = "";
if(searchEngine == 1){
finalSearchString = "http://www.google.es" + searchString;
}
if(searchEngine == 2){
finalSearchString = "http://www.elpais.com" + searchString;
}
if(searchEngine == 3){
finalSearchString = "http://www.elmundo.es" + searchString;
}
if(searchEngine == 4){
finalSearchString = "http://www.publico.es" + searchString;
}
if(searchEngine == 5){
finalSearchString = "http://www.abc.es" + searchString;
}
location.href = finalSearchString;
}
}
// -->
</script>
<basefont face="Verdana, Arial, sans-serif">
</span>
<form name="searchForm">
<div align="center">
<center>
<table width=323 border="2" cellpadding=3 cellspacing=0 bgcolor=444444 style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td bgcolor=lightblue width="148"><font size="1"><span lang="es">Buscar por:</span></font><font size=1 face="Verdana, Arial, sans-serif"><span lang="es"><br>
</span>
<td bgcolor=lightblue width="96"><font size="1"><span lang="es">Buscar desde:</span></font><span lang="es">
<td bgcolor=lightblue width="90">
<tr>
<td bgcolor=navajowhite width="148">
<input style="background: dddddd" type="text" size="20">
<td bgcolor=navajowhite width="96">
<select style="background: dddddd">
<option selected>Google
<option>El Pais
<option>El Mundo
<option>Publico
<option>ABC
</select>
<td bgcolor=navajowhite width="90">
<input type="button" value="Buscar " onClick="startSearch()">
</select>
</table>
</center>
</div>
</form>
</span> </td>
</tr>
</body>
</html>
El código es este:
<html>
<body>
<tr>
<td width="100%">
<p align="center"> </td>
</tr>
<tr>
<td width="100%"> </td>
</tr>
<tr>
<td width="100%" style="text-indent: 0" height="19">
<span lang="es">
<script>
<!--
function startSearch(){
searchString = document.searchForm.searchText.value;
if(searchString != ""){
searchEngine = document.searchForm.whichEngine.selectedIndex + 1;
finalSearchString = "";
if(searchEngine == 1){
finalSearchString = "http://www.google.es" + searchString;
}
if(searchEngine == 2){
finalSearchString = "http://www.elpais.com" + searchString;
}
if(searchEngine == 3){
finalSearchString = "http://www.elmundo.es" + searchString;
}
if(searchEngine == 4){
finalSearchString = "http://www.publico.es" + searchString;
}
if(searchEngine == 5){
finalSearchString = "http://www.abc.es" + searchString;
}
location.href = finalSearchString;
}
}
// -->
</script>
<basefont face="Verdana, Arial, sans-serif">
</span>
<form name="searchForm">
<div align="center">
<center>
<table width=323 border="2" cellpadding=3 cellspacing=0 bgcolor=444444 style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td bgcolor=lightblue width="148"><font size="1"><span lang="es">Buscar por:</span></font><font size=1 face="Verdana, Arial, sans-serif"><span lang="es"><br>
</span>
<td bgcolor=lightblue width="96"><font size="1"><span lang="es">Buscar desde:</span></font><span lang="es">
<td bgcolor=lightblue width="90">
<tr>
<td bgcolor=navajowhite width="148">
<input style="background: dddddd" type="text" size="20">
<td bgcolor=navajowhite width="96">
<select style="background: dddddd">
<option selected>Google
<option>El Pais
<option>El Mundo
<option>Publico
<option>ABC
</select>
<td bgcolor=navajowhite width="90">
<input type="button" value="Buscar " onClick="startSearch()">
</select>
</table>
</center>
</div>
</form>
</span> </td>
</tr>
</body>
</html>
1 Respuesta
Respuesta de krlosnow
1