function nuevoAjax() { var xmlhttp=false; 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 cargaContenido() { var valor=document.getElementById("select_0").options[document.getElementById("select_0").selectedIndex].value; if(valor==0) { combo=document.getElementById("select_1"); combo.length=0; var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Selecciona Pais..."; combo.appendChild(nuevaOpcion);combo.disabled=true; } else { ajax=nuevoAjax(); ajax.open("GET", "destinos.php?seleccionado="+valor, true); ajax.onreadystatechange=function() { if (ajax.readyState==1) { combo=document.getElementById("select_1"); combo.length=0; var nuevaOpcion=document.createElement("option"); nuevaOpcion.value=0; nuevaOpcion.innerHTML="Cargando..."; combo.appendChild(nuevaOpcion); combo.disabled=true; } if (ajax.readyState==4) { document.getElementById("fila_2").innerHTML=ajax.responseText; } } ajax.send(null); } }