Programación Web y Scripting > PHP

 Problema con combobox dependientes

<< < (2/2)

talcual:
ruedalo en firefox y luego buscas el menu herramientas en la opcion consola de errores y mira a ver q error te sale
y ejecuta por separado el php ademas

tbn puedes devolver en vez del innerhtml devuelve un alert con el contenido q te trae el php y tendras una guia de donde puede estar el error

dark_monk9:
Ya funciono usando AJAX, ahora el problema es que funciona solo en Internet Explorer, en FireFox no funciona, el FF es version 3.0.9. ya mire en google y he cambiado miles de veces la forma en que se hace la conexion pero no he logrado que funcione.

Este es el codigo:


function NuevoAjax(){
var xmlhttp=true;
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(E){
xmlhttp = false;
}
}

if(!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}

function Cargar(url){

var resultado='';

ajax=NuevoAjax();
ajax.open("GET", url,true);



ajax.onreadystatechange=function()
{
if(ajax.readyState==1)
{
// aqui va el preload si se requiere...";
}
else if(ajax.readyState==4)
{
if(ajax.status==200)
{
resultado=unescape(ajax.responseText);
}
else
{
resultado="Error:".ajax.status;
}
}
}

ajax.send(null);
return resultado;

}



function CargarMunicipios(estado,cmb_a_Cargar,seleccionado, divNombre)
{

var contenido,total,seleccionar=0,Lista;



var ComboList = document.getElementById(cmb_a_Cargar);
var divMunicipios=document.getElementById(divNombre);



Cargar("municipios.php?edo="+estado);
divMunicipios.innerHTML=Cargar("municipios.php?edo ="+estado);

Lista = document.getElementById('lista');



ComboList.innerHTML="";



if (Lista!=null)
{
Nodo = Lista.firstChild;
}


try
{
total=Lista.childNodes.length;
}
catch(E)
{
total=0;
}


for (i=1;i<=(total);i++)
{
id del Nodo
ComboList.options=new Option(unescape(Nodo.innerText),Nodo.id);


if (Nodo.id==seleccionado)
{
seleccionar=i-1;
}

Nodo=Nodo.nextSibling;
}


if (total>0)
{
//Borrar el elemento en blanco que se inserta al inicio
ComboList.options[0]=null;

//Posicionarse en la opcion seleccionada
ComboList.options[seleccionar].selected="selected";
}


}

Navegación

[0] Índice de Mensajes

[*] Página Anterior

Ir a la versión completa