function _xgetXmlHttpRequest() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } } var _xcmsajaxhttp = _xgetXmlHttpRequest(); //785 function getsql(url, sql, destino, valor_actual, objvalue){ if (navigator.appName=='Microsoft Internet Explorer') _xcmsajaxhttp.open("POST", url+'?sql='+sql+'&oval='+objvalue, true); else _xcmsajaxhttp.open("POST", url+'?sql='+sql+'&oval='+objvalue, true); _xcmsajaxhttp.onreadystatechange = function(){ if (_xcmsajaxhttp.readyState==4){ document.getElementById(destino).options.length = 0; var resultado = _xcmsajaxhttp.responseText; var temp = new Array(); var linha = new Array(); temp=resultado.split("###||###"); for (i=0;i<=temp.length-2;i++) { estalinha=temp[i]; linha = estalinha.split("###|###"); document.getElementById(destino).options[i] = new Option(linha[1],linha[0]); if (linha[0]==valor_actual) document.getElementById(destino).options[i].selected=true; } if (temp.length==1) { document.getElementById(destino).options[0] = new Option('','0'); document.getElementById(destino).options[0].selected=true; } var estacaixa=document.getElementById(destino); if (estacaixa.fireEvent){ estacaixa.fireEvent('onchange'); } else { if (estacaixa.onchange) estacaixa.onchange(); } document.getElementById(destino+'_waitajax').style.visibility='hidden'; } } _xcmsajaxhttp.send(null); } function getlist(obj,sql,valor_actual,objvalue) { var miniwait=obj+'_waitajax'; document.getElementById(miniwait).style.visibility='visible'; var sql = encodeURIComponent(sql); getsql("datafuncs.php",sql, obj, valor_actual, objvalue); /* var estacaixa=document.getElementById(obj); var e = document.createEvent('HTMLEvents'); e.initEvent('change', false, false); estacaixa.dispatchEvent(e); */ }