By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,377 Members | 1,672 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,377 IT Pros & Developers. It's quick & easy.

Firefox and CSS popup problem

P: 15
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)

Expand|Select|Wrap|Line Numbers
  1.  
  2. <img name=showHobbies src="" style="position:absolute;left:550;top:25;width:100;height:50" onmouseover="show(fullfile)" onmouseout="hide()">
  3.  
  4.            function show(dataSource)
  5.             {
  6.  
  7.  
  8.  
  9.             if (window.ActiveXObject) {
  10.  
  11.             var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  12.             xmlDoc.async = false;
  13.             xmlDoc.load(dataSource);
  14.  
  15.  
  16.            var stringHobby = xmlDoc.documentElement.lastChild.firstChild.nodeValue;
  17.             var name = xmlDoc.getElementsByTagName("first")[0].firstChild.nodeValue;
  18.            document.getElementById("popup").innerHTML = name + "'s hobbies:\n" + stringHobby;
  19.  
  20.             }
  21.  
  22.             else {
  23.  
  24.              xmlDoc2= document.implementation.createDocument("","",null);
  25.              xmlDoc2.load(dataSource);
  26.  
  27.             // alert(xmlDoc2);
  28.             var x = xmlDoc2.getElementsByTagName("hobbies")[0].firstChild.nodeValue;
  29.             var name = xmlDoc2.getElementsByTagName("first")[0].firstChild.nodeValue;
  30.              //alert(x);
  31.             document.getElementById("popup").innerHTML=x;
  32.             //document.getElementById("popup").innerHTML="blah blah blah";
  33.  
  34.  
  35.             //myXMLHTTPRequest = new XMLHttpRequest();
  36.             //myXMLHTTPRequest.open("GET", dataSource, false);
  37.             //myXMLHTTPRequest.send(null);
  38.             //var xmlDoc = myXMLHTTPRequest.responseXML;
  39.  
  40.  
  41.  
  42.            //var stringHobby = xmlDoc.documentElement.lastChild.firstChild.nodeValue;
  43.            // var name = xmlDoc.getElementsByTagName("first")[0].firstChild.nodeValue;
  44.            //document.getElementById("popup").innerHTML = name + "'s hobbies:\n" + stringHobby;
  45.             }
  46.  
  47.  
  48.  
  49.  
  50.             var popwin = document.getElementById("popup");
  51.             popwin.style.visibility="visible";
  52.  
  53.  
  54.             }
  55.  
  56.  
  57.             function hide()
  58.             {
  59.             var popwin = document.getElementById("popup");
  60.             popwin.style.visibility="hidden";
  61.             }
  62.  
Jun 22 '07 #1
Share this Question
Share on Google+
5 Replies


acoder
Expert Mod 15k+
P: 16,027
Maybe you could call the Firefox/Opera/Safari, etc. code after the file has fully loaded:
Expand|Select|Wrap|Line Numbers
  1. xmlDoc2.onload= function() {...
Jun 23 '07 #2

pbmods
Expert 5K+
P: 5,821
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.
Jun 23 '07 #3

P: 15
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.
Jun 24 '07 #4

acoder
Expert Mod 15k+
P: 16,027
Where's the code for the CSS popup? How are you positioning it?
Jun 25 '07 #5

P: 15
here is the html for the popup

Expand|Select|Wrap|Line Numbers
  1.  
  2.       <div id="popup" style="left:800px; top:50px; width:150px; height:70px;"></div>
  3.         <div id="restext"></div>
  4.  
  5.         <br />
  6.         <div id="serverResponse" style="margin-left:100;margin-top:150;color:#FFFFFF;font-family:arial"></div>
  7.  
  8.  
Jun 26 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.