function getHTTPObject() { var xmlhttp; /*@cc_on @if (@_jscript_version >= 5) try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @else xmlhttp = false; @end @*/ if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp = false; } } return xmlhttp; } var enProceso = false; // lo usamos para ver si hay un proceso activo var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest function handleHttpResponseGeneral() { if (http.readyState == 4) { if (http.status == 200) { if (http.responseText.indexOf('invalid') == -1) { // Obtenemos el nombre de la funcion y el parametro a ejecutar results = http.responseText.split( '\n' ); eval( results[0] + '(' + results[1] + ')' ); enProceso = false; } } } } function RequestAJAXGeneral(url, query) { if(!enProceso && http) { /* query = "pet=dog&hobby=painting"; //Parametros a pasar a la página url = "http://www.mydomain.com/index.php"; //Página a la que le pasamos los parametros */ //url = url + "?" + query; if(url.indexOf('http://')==-1)url='http://' + location.host + '/' + url http.open("POST", url, true); http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); http.onreadystatechange = handleHttpResponseGeneral; enProceso = true; http.send( query ); } } function RequestAJAXGeneralGET(url, query) { if(!enProceso && http) { /* query = "pet=dog&hobby=painting"; //Parametros a pasar a la página url = "http://www.mydomain.com/index.php"; //Página a la que le pasamos los parametros */ url = url + "?" + query; if(url.indexOf('http://')==-1)url='http://' + location.host + '/' + url http.open("GET", url, true); http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); http.onreadystatechange = handleHttpResponseGeneral; enProceso = true; http.send( null ); } } function CambiarOuterHTML( IdObj, HTML ) { var obj = document.getElementById(IdObj); if(obj)obj.outerHTML = HTML; } function CambiarInnerHTML( IdObj, HTML ) { var obj = document.getElementById(IdObj); if(obj) { obj.innerHTML = HTML; if(HTML=='') obj.style.display='none'; else obj.style.display='block'; } } function escribeme(txt) { document.write(txt); } function multipleAJAX( url, query, method, idAjax ) { var http = getHTTPObject(); multipleAJAX.handleHttpResponseGeneral = function() { if (http.readyState == 4) { if (http.status == 200) { if (http.responseText.indexOf('invalid') == -1) { // Obtenemos el nombre de la funcion y el parametro a ejecutar var results = http.responseText.split( '\n' ); eval( results[0] + '(' + results[1] + ')' ); } } } } if(http) { /* query = "pet=dog&hobby=painting"; //Parametros a pasar a la página url = "http://www.mydomain.com/index.php"; //Página a la que le pasamos los parametros */ if(url.indexOf('http://')==-1)url='http://' + location.host + '/' + url http.open(method, url, true); http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); http.onreadystatechange = multipleAJAX.handleHttpResponseGeneral; http.send( query ); } }