Foros del Web » Programando para Internet » Javascript » Frameworks JS »

fuciona en chrome y firefox PERO NO EN IE!!

Estas en el tema de fuciona en chrome y firefox PERO NO EN IE!! en el foro de Frameworks JS en Foros del Web. buenas, la cosa es que este codigo javascript-jquery me funciona perfectamente en chrome y firefox pero no en Internet Explorer, alguien me puede decir donde ...
  #1 (permalink)  
Antiguo 19/11/2011, 03:43
 
Fecha de Ingreso: enero-2010
Mensajes: 97
Antigüedad: 14 años, 2 meses
Puntos: 3
Exclamación fuciona en chrome y firefox PERO NO EN IE!!

buenas, la cosa es que este codigo javascript-jquery me funciona perfectamente en chrome y firefox pero no en Internet Explorer, alguien me puede decir donde esta el fallo???
---------------
function createTooltipEvents()
{
//insert the tooltip separators in tooltipLayer
$("#tooltipLayer").html('<table width="210" border="0" cellspacing="0" cellpadding="0"><tr><td width="5" height="5" background="/images/separators/tooltip/upleft.jpg"></td><td width="200" height="5" background="/images/separators/tooltip/horizontal.jpg"></td><td width="5" height="5" background="/images/separators/tooltip/upright.jpg"></td></tr><tr><td width="5" background="/images/separators/tooltip/vertical.jpg"></td><td width="200" bgcolor="#151515" id="tooltipCenter" align="center"></td><td width="5" background="/images/separators/tooltip/vertical.jpg"></td></tr><tr><td width="5" height="5" background="/images/separators/tooltip/downleft.jpg"></td><td width="200" height="5" background="/images/separators/tooltip/horizontal.jpg"></td><td width="5" height="5" background="/images/separators/tooltip/downright.jpg"></td></tr></table>');


//initialize the center as loading...
$("#tooltipCenter").html('<tr><td class="WhiteBold12" align="center">Cargando...</td></tr>');
const maxInventory = 24;
var elements = new Array();
for ( i = 1; i <= maxInventory; i++)
{
elements[i] = new Array(2)
elements[i] = ['item'+i,'Cargando...'];
}
jQuery.each(elements, function(i)
{
var name = "#"+this[0];
conectionAjax(elements,i);

//+++++**mouseover**++++++
$(name).mouseover(function()
{
//get the x,y coordinates
//--x--
var x = $(name).offset().left;
if(x >= 340)
{
x -= 210; //coordenada X si sale a la izquierda
}else{
x += 80; //Get X coodrinates
}
//--y--
var y = $(name).offset().top;
//set de coordinates on tooltipLayer
$("#tooltipLayer").css( "left",x );
$("#tooltipLayer").css( "top",y );

//set the tooltip in information
//...
$("#tooltipCenter").html(elements[i][1]);
//pasao = name.replace("#", "");
//mostrar = conectionAjax(pasao)

//$("#tooltipCenter").html(elements[1][0]);

//show the tooltipLayer
$("#tooltipLayer").show();
});
//+++++**mouseout**++++++
$(name).mouseout(function()
{
$("#tooltipLayer").hide();
$("#tooltipCenter").html('<tr><td class="WhiteBold12" align="center">Cargando...</td></tr>');
});
});
};

/**
*
* Funtion that creates the ajax object
**/

function createAjax()
{

var xmlhttp=false;
try
{
// Creacion del objeto AJAX para navegadores no IE
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
// Creacion del objet AJAX para IE
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(E) { xmlhttp=false; }
}
if (!xmlhttp && typeof XMLHttpRequest!="undefined") { xmlhttp=new XMLHttpRequest(); }

return xmlhttp;
}


/**
*
* Funtion that makes the conection with the php
**/

function conectionAjax(elements,id)
{
var ajax=createAjax();
ajax.open("POST", "getTooltip.php", true);
ajax.onreadystatechange=function()
{
if (ajax.readyState==4)
{
if( ajax.status == 200 )
{
// Muestro el mensaje enviado desde el servidor
elements[id][1] = ajax.responseText;
}
}

}
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.send("id="+id);
}
-------------------
gracias de antemano.
  #2 (permalink)  
Antiguo 20/11/2011, 21:46
Avatar de Naahuel  
Fecha de Ingreso: marzo-2011
Ubicación: localhost
Mensajes: 796
Antigüedad: 13 años, 1 mes
Puntos: 192
Respuesta: fuciona en chrome y firefox PERO NO EN IE!!

Uff, no se entiende nada ahí. Cuando postees código usás las etiquetas para resaltar (en el combo "highlight").

No entiendo el código para nada, pero veo que estás usando AJAX. Ya que usás jQuery, ¿por qué no usás ajax con jquery? Además de ser 10000 más fácil, jQuery se ocupa de todas las cuestiones cross-browser y te asegurás que funcione bien en todos los navegadores.
__________________
nahueljose.com.ar
  #3 (permalink)  
Antiguo 22/11/2011, 06:18
Avatar de chichote
Colaborador
 
Fecha de Ingreso: diciembre-2004
Ubicación: Santiago - Chile
Mensajes: 1.868
Antigüedad: 19 años, 4 meses
Puntos: 145
Respuesta: fuciona en chrome y firefox PERO NO EN IE!!

Hola reonevk.

Podrias detallar mas tu problema? el foro esta para guiar, orientar, facilitar el aprendizaje, no para entregar las soluciones en bandejas. De que trata tu aplicacion? que es lo que hace especificamente ese javascript?

Veamos si esto te ayuda, muchas veces el error no es del javascript y sino mas bien de tu html, por lo que veo estas trabajando todo con ID (#). Debes tener claro que los ID deben ser unicos, por alguna razon firefox y chrome funciona cuando repites ID, pero IE es mas estricto en ese aspecto. Si tienes varios elementos y quieres tratarlos con jquery, deberas utilizar class y trabajarlos como $(".miclass").

Saludos.
__________________
http://chicho.ninja yiaaaa

Etiquetas: ajax, chrome, firefox, funcion, html, jquery, php
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:44.