Firefox and CSS popup problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jpk872
    New Member
    • Jun 2007
    • 15

    Firefox and CSS popup problem

    I've got an image, when I mouse over it a popup window shows and the person's hobbies are displayed using a CSS popup window. It works in IE, but not Firefox. Any idea why? (lines 23-31)

    Code:
    <img name=showHobbies src="" style="position:absolute;left:550;top:25;width:100;height:50" onmouseover="show(fullfile)" onmouseout="hide()">
     
               function show(dataSource)
                {
    
               
               
                if (window.ActiveXObject) {
               
                var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
                xmlDoc.async = false;
                xmlDoc.load(dataSource);
               
               
               var stringHobby = xmlDoc.documentElement.lastChild.firstChild.nodeValue;
                var name = xmlDoc.getElementsByTagName("first")[0].firstChild.nodeValue;
               document.getElementById("popup").innerHTML = name + "'s hobbies:\n" + stringHobby;
               
                }
               
                else {
               
                 xmlDoc2= document.implementation.createDocument("","",null);
                 xmlDoc2.load(dataSource);
                 
                // alert(xmlDoc2);
                var x = xmlDoc2.getElementsByTagName("hobbies")[0].firstChild.nodeValue;
                var name = xmlDoc2.getElementsByTagName("first")[0].firstChild.nodeValue;
                 //alert(x);
                document.getElementById("popup").innerHTML=x;
                //document.getElementById("popup").innerHTML="blah blah blah";
               
                 
                //myXMLHTTPRequest = new XMLHttpRequest();
                //myXMLHTTPRequest.open("GET", dataSource, false);
                //myXMLHTTPRequest.send(null);
                //var xmlDoc = myXMLHTTPRequest.responseXML;
               
               
               
               //var stringHobby = xmlDoc.documentElement.lastChild.firstChild.nodeValue;
               // var name = xmlDoc.getElementsByTagName("first")[0].firstChild.nodeValue;
               //document.getElementById("popup").innerHTML = name + "'s hobbies:\n" + stringHobby;
                }
               
                   
               
               
                var popwin = document.getElementById("popup");
                popwin.style.visibility="visible";
    
             
                }
               
               
                function hide()
                {
                var popwin = document.getElementById("popup");
                popwin.style.visibility="hidden";
                }
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Maybe you could call the Firefox/Opera/Safari, etc. code after the file has fully loaded: [CODE=javascript]xmlDoc2.onload= function() {...[/CODE]

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, jpk.

      Are you getting an error message, or is the code just not executing?

      Try adding an alert() statement in your show() function and moving it around until the alert stops showing up. Then you know where your problem is.

      Comment

      • jpk872
        New Member
        • Jun 2007
        • 15

        #4
        Hi,

        If you look at line 29, "alert(x)" works, but innerHTML doesn't. I was thinking maybe for some reason the popup window is covered or off the screen.

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #5
          Where's the code for the CSS popup? How are you positioning it?

          Comment

          • jpk872
            New Member
            • Jun 2007
            • 15

            #6
            here is the html for the popup

            Code:
                  <div id="popup" style="left:800px; top:50px; width:150px; height:70px;"></div>
                    <div id="restext"></div>
                   
                    <br />
                    <div id="serverResponse" style="margin-left:100;margin-top:150;color:#FFFFFF;font-family:arial"></div>

            Comment

            Working...