Hi! I'm learning JQuery, and I have a problem to solve.

This script is working fine with google and firefox, but IE 8. It does
nothing in IE... I don't know what I'm doing wrong, or what else I can
change.

 I'm using a plugin to convert a string of XML to a DOM object with
jQuery, it's from "http://outwestmedia.com/jquery-plugins/xmldom/";.
And the script should show the description of every word that was
clicked and have the style "palavra-chave"(in english it means
keyword). The description  is written in an XML file. I'll show the
script (please, remember that I'm a begginer, it may be a ridiculous
script for you):


$(document).ready(function(){

$(document.body).append("<div class=descr> </div>");

        $(function(){

        $(".palavra_chave").click(function(e){
        var palavra = $(this).text();
        var x = e.pageX;
        var y = e.pageY;
        var     posX = $(window).width()/2;

        $.ajax({
                   type:"GET",
                   url: "so_xml.xml",
                   dataType: "html",
                   contentType: "application/x-www-form-urlencoded;
charset=iso-8859-1",
                   success: function (xml) {

                                $.xmlDOM(xml).find('palavras').each(function(){

                                        var texto = 
$(this).find(palavra).text();

                                        if(x>posX)
                                        {
                                        var z = x-400;
                                        var y = y-100;
                                        $(".descr").css({"top":y, "left":z, 
"position":"absolute", "z-
index":"10", "background-color":"#a2cffc"});
                                        $(".descr").html("<table width='200' 
border='0' cellspacing='0'
cellpadding='0'><tr><td>" + texto + "</td></tr></table>");
                                        $(".descr").fadeIn('fast');
                                        $(".descr").fadeIn(z +', '+ y);
                                        $(".descr").hover('out', 
function(){$(".descr").fadeOut
('fast')});
                                        }
                                        else {
                                        var y = y-100;
                                        $(".descr").css({"top":y, "left":x, 
"position":"absolute", "z-
index":"10" , "background-color":"#a2cffc"});
                                        $(".descr").html("<table width='200' 
border='0' cellspacing='0'
cellpadding='0'><tr><td>" + texto + "</td></tr></table>");
                                        $(".descr").fadeIn('fast');
                                        $(".descr").fadeIn(x +', '+ y);
                                        $(".descr").hover('out', 
function(){$(".descr").fadeOut
('fast')});
                                        }
                                });
                        }
                 });
        });
        });
});

Reply via email to