![]() |
![]() |
![]() |
![]() |
![]() |
FTP | ![]() |
![]() |
CCD | ![]() |
![]() |
Buscar | ![]() |
![]() |
Trucos | ![]() |
![]() |
Trabajo | ![]() |
![]() |
Foros | ![]() |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
||||
|
||||
AJAX - Funciona en Firefox y no en iexplorer/opera
Veamos, ando programando una aplicación web con PHP,XHTML,CSS y firebird.
A parte, me he metido de lleno con todo el fregado del Ajax (xmlhttprequest). El caso es que la aplicación, funciona de maravilla con Firefox pero con iexplorer y Opera me falla uno de los apartados. Es un formulario de texto, en el cual voy entrando caracteres y realizo una búsqueda en nuestra DB de clientes y mediante Ajax me muestra las coincidencias justo en un recuadro (<div id="autocompletediv"> debajo y se recalcula con cada nueva pulsación. El caso es que salvo con Firefox, con los otros dos no hace nada de nada y no se por que debe fallar (pero ni la mas remota idea, para que mentir ![]() Procedo a añadir todo el código pertinente: Código PHP:
Código:
function findPosX(obj){ var curleft = 0; if (obj.offsetParent){ while (obj.offsetParent){ curleft += obj.offsetLeft obj = obj.offsetParent; } } else if (obj.x){ curleft += obj.x; } return curleft; } function findPosY(obj){ var curtop = 0; if (obj.offsetParent){ while (obj.offsetParent){ curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.y){ curtop += obj.y; } return curtop; } function autocomplete (thevalue, e){ theObject = document.getElementById("autocompletediv"); theObject.style.visibility = "visible"; theObject.style.width = "152px"; var posx = 0; var posy = 0; posx = (findPosX (document.getElementById("yourname")) + 1); posy = (findPosY (document.getElementById("yourname")) + 23); theObject.style.left = posx + "px"; theObject.style.top = posy + "px"; var theextrachar = e.which; if (theextrachar == undefined){ theextrachar = e.keyCode; } //The location we are loading the page into. var objID = "autocompletediv"; //Take into account the backspace. if (theextrachar == 8){ if (thevalue.length == 1){ var serverPage = "autocomp.php"; } else { var serverPage = "autocomp.php" + "?sstring=" + thevalue.substr (0, (thevalue.length -1)); } } else { var serverPage = "autocomp.php" + "?sstring=" + thevalue + String.fromCharCode (theextrachar); } var obj = document.getElementById(objID); xmlhttp.open("GET", serverPage); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { obj.innerHTML = xmlhttp.responseText; } } xmlhttp.send(null); } function setvalue (thevalue, companyaddressid){ acObject = document.getElementById("autocompletediv"); acObject.style.visibility = "hidden"; acObject.style.height = "0px"; acObject.style.width = "0px"; document.getElementById("yourname").value = thevalue; document.getElementById("companyaddressid").value = companyaddressid; } Código PHP:
Cuando no va, no llega ni a realizar el amago de autocompletado. No se por donde pillarlo, la verdad, pero bueno, espero que alguien arroje un poco de luz sobre todo este asunto. Saludos.
__________________
"El aprendizaje potencia la intuición" Yo mismo, en un momento de inspiración. v2.0 |
|
|
![]() |
||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Microsot dice: usar Firefox u Opera | Casimiro Notevi | Noticias | 18 | 14-02-2007 20:34:31 |
Policías americanos se entrenan en los secretos de Opera y Firefox | Sasuke_Cub | Noticias | 1 | 04-09-2005 19:39:40 |
Página principl no funciona con Firefox... | Sinaloense | Noticias | 3 | 28-10-2004 17:59:30 |
Manipular el IExplorer | Joanna | Internet | 0 | 18-05-2004 01:04:01 |
Refrescar una ventana del IExplorer | DarkByte | Internet | 1 | 17-05-2004 22:13:30 |
![]() |
|