Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/09/2007, 09:56
Avatar de jahman
jahman
 
Fecha de Ingreso: noviembre-2003
Ubicación: Oslo
Mensajes: 230
Antigüedad: 20 años, 5 meses
Puntos: 0
Buscador con Ajax

Sres un saludo...
logre hacer un buscador con ajax onda que minestras escribes la palabras en el textfields se va generando la buscando visualizandose abajo el problema es que si hago click afuera del cajon pierdo el evento y cuando quiero ingresar otra busqueda el cajon se encuentra bloqueado no se xq podria alguien decirme xq pasa esto....espero que me puedan ayudar. Gracias.

Código HTML:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/acceso.asp" -->
<%
If (Request.QueryString("Search") <> "") Then 
  Search = Request.QueryString("Search")
End If

If (Request.QueryString("go") <> "") Then 
  go = Request.QueryString("go")
End If

%>
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<script language="JavaScript" type="text/JavaScript">

function ventanaG(URL,ancho,alto) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+ ancho +',height='+ alto +',left = 400,top = 100');");
}

function nuevoAjax() { 
   /* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por 
   lo que se puede copiar tal como esta aqui */ 
   var xmlhttp=false; 
   try    { 
      // Creacion del objeto AJAX para navegadores no IE 
      xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
   } 
   catch(e)    { 
      try       { 
         // Creacion del objet AJAX para IE 
         xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
      } 
      catch(E) { xmlhttp=false; } 
   } 
   if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 
   return xmlhttp; 
} 

function cargaContenido() {
   	var valor=document.getElementById("buscar").value; 
   			ajax=nuevoAjax();
      		ajax.open("GET", "../buscador.asp?Ipla=1&buscar="+valor, true); 
			ajax.onreadystatechange=function()	{ 
					if (ajax.readyState==4) { 
						document.getElementById("fila_2").innerHTML=ajax.responseText; 
					}	
			}
      	ajax.send(null); 	
} 

</script>
</head>

<body>
		<table border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td valign="top">&nbsp;</td>
				<td><input type="text" id="buscar" name="buscar" size="20" onkeyup="cargaContenido()" ></td>
			</tr>
		</table>
		<input type="hidden" name="Search" value="form1">
	<table>
		<tr>
		<td bgcolor="#FFCC00" class="txContenido"><strong>MotivoII</strong></td>
   		<td id="fila_2" ></td> 
  	</tr>
	</table>
</body>
</html>