SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Location
    Melbourne, Australia
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mozilla and elementid.style.visibility ARGH!

    Basically I have this code:
    Code:
    function onmainlinkinfobox(idx){
    idx.style.visibility='visible';
    }
    function outmainlinkinfobox(idx){
    idx.style.visibility='hidden';
    }
    It works fine in IE and Opera but not at all in mozilla.

    I have tried adding 'ducument.all' and that didnt help. Even if I specidy the actual element id rather than using a variable it still wont work.

    Any ideas?

    BTW: To see the site go to: (http://www28.brinkster.com/jixor/dev2/)

  2. #2
    + platinum's Avatar
    Join Date
    Jun 2001
    Location
    Adelaide, Australia
    Posts
    6,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML Code:
    idx.style.display='none';
    idx.style.display='';
    might work as an alternative Not sure why that above example wouldn't though! Got it online to view?

  3. #3
    SitePoint Zealot oivaf's Avatar
    Join Date
    Apr 2003
    Location
    Mexico
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    by using the Mozilla's Javascript Console I realized what was the error:

    1st in you Html code you have to call the function with the parameter between quotes like this:
    Code:
    <a href="#" onmouseover="onmainlinkinfobox('malo') ...etc.
    And use getElementById to access the element properties like this:
    PHP Code:
    function onmainlinkinfobox(idx){
    div document.getElementById(idx).style;
    div.visibility 'visible';
    //idx.style.visibility='visible';
    }

    function 
    outmainlinkinfobox(idx){
    div document.getElementById(idx).style;
    div.visibility='hidden';
    //idx.style.visibility='hidden';

    I testes it on Konqueror 3.1.2 and Mozilla 1.4

    HTH

  4. #4
    SitePoint Enthusiast
    Join Date
    Sep 2002
    Location
    Melbourne, Australia
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks very much!
    I have not had much experiance with mozilla (shame, heh) so thanks again for pointing out the javascript console!


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
  •