Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/02/2007, 09:15
vero_nati
 
Fecha de Ingreso: enero-2007
Mensajes: 6
Antigüedad: 17 años, 4 meses
Puntos: 0
Re: xml has no properties!!!

Event.observe(window, "load", window_load, false);
2function window_load()
3 {
4 Event.observe(document.getElementById("BUSCAR"), "keyup", buscar_empleado, false);
5 }
6
7function buscar_empleado()
8{
9 var lstEmpleados=document.getElementById("EMPLEADOS");
10 lstEmpleados.value="0";
11 for (i=lstEmpleados.length;i>0;i--)
12 {
13 lstEmpleados.removeChild(lstEmpleados.lastChild);
14 }
15
16 if (document.getElementById("BUSCAR").value != '')
17 {
18 ajax=NuevoAJAX();
19 ajax.open("GET", "empleado_Ale_ajax.php?rutina=trae_empleados&busca r_por=" + document.getElementById("BUSCAR_POR").value + "&buscar=" + document.getElementById("BUSCAR").value, true);
20 ajax.onreadystatechange=function()
21 {
22 if (ajax.readyState==4)
23 {
24 if (ajax.status==200)
25 {
26 var xml=ajax.responseXML;
27 //var xml=ajax.responseText;
28 //alert(xml);
29 var lstEmpleados=document.getElementById("EMPLEADOS");
30 var rs=xml.getElementsByTagName("rowdatos");()
31 for (i=0;i<rs.length;i++)
32 {
33 nuevaopcion=document.createElement("option");
34 valor=document.createAttribute("value");
35 valor.value=rs[i].childNodes[0].firstChild.nodeValue;
36 nuevaopcion.setAttributeNode(valor);
37 nuevaopcion.appendChild(document.createTextNode(rs[i].childNodes[2].firstChild.nodeValue + " - " + rs[i].childNodes[1].firstChild.nodeValue));
38 lstEmpleados.appendChild(nuevaopcion);
39 }
40 }
41 }
42 }
43 ajax.send(null);
44 }
45}
46
47