Results 1 to 4 of 4

Thread: Popup info box and ONMOUSEOVER not working with firefox

  1. #1
    Join Date
    Jun 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Popup info box and ONMOUSEOVER not working with firefox

    1) Script Title: Popup information box II

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex5/popinfo2.htm

    3) Describe problem: I am trying to implement this code into my website, with a few little modifications. First of all, the example code works fine on the dynamic drive website, but it does not work on my site. Secondly, what I have does work fine in Internet Explorer and Safari, but it does not work in Firefox. Just curious if I could get some help. . .

    Firstly, I'll describe what I am trying to do. I am trying to have the popup information box pop up with dynamically created information in it. More or less, a person uploads a picture to my website, and I they input their name into a form. The name is then written to a mysql table. The Popup box then reads the name, and displays the message: "This picture was uploaded by: userX"

    Now, what happens is this. Once again, it works perfectly in IE, but in Firefox the popup box appears only in the upper left corner, instead of following the mouse around. If you would like to see what I am talking about, here is the website address:

    http://www.photomosaicproject.com/photographs.php

    Here is the code that I believe is the problem:
    PHP Code:
    echo '<a href="'.$row[0].'" target="_blank" ONMOUSEOVER="popup(\'This picture was uploaded by: '.$name[0].' '.$name[1].'\',\'lightyellow\');" ONMOUSEOUT="kill()"><img src="/uploads/'.$images[$i+1] .'" border=0 width=200 height=200></a>'
    Other than that code, I've copied everything else verbatim from the example page.

    Any ideas? Thanks!

  2. #2
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    I'm heading to bed, so I'll check more tomorrow, but FF is throwing warnings..."Error parsing value 'left'", "Error parsing value 'top'". Something is screwy in that section of js, I think IE might be kind enough to ignore it.
    Verzeihung!

  3. #3
    Join Date
    Dec 2004
    Posts
    177
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default

    Alright, there's a couple things I changed, and then, of course, the all important fix.

    Original:
    Code:
    function get_mouse(e){
    var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
    skn.left=x+Xoffset;
    var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
    skn.top=y+yyy;
    }
    First, yyy is only declared in another function, so it really "shouldn't" work here, so I replaced it with Yoffset, which is a global variable, same as Xoffset.

    Second, and this is a quirk with Firefox 1.5+...well, I call it a quirk, though technically it's the proper way to code. Any value that you create dynamically, still needs to have a unit of measure! Ex., box.width = x becomes box.width = x+"px"
    You can complain about how unfair this is, but frankly the unit of measure is VERY important. Ask NASA. So like I said, and is usually the case with Firefox-only errors, it's a coding problem that IE is kind enough to ignore.

    Updated:
    Code:
    function get_mouse(e){
    var x = (ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
    skn.left= x + Xoffset +"px";
    var y = (ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
    skn.top= y + Yoffset + "px";
    }
    Last edited by Minos; 06-07-2008 at 11:03 AM.
    Verzeihung!

  4. #4
    Join Date
    Jun 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Worked perfectly! Thanks so much for that reply! I've been working on that for the past couple weeks, so it's nice to put it under the "completed" list! Thanks again!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •