/    Sign up×
Community /Pin to ProfileBookmark

Intermittent show/hide JavaScript issue

I have an annoying intermittent problem with showing and hiding a menu system in a newspaper multimedia site I am developing. It occurs in Firefox (2.0.0.13).

The problem:

Go to [url]http://media.theaustralian.com.au/multimedia/galleries/flexiplayer.html[/url]
Go to the menu in the right-hand column, choose any of the categories under ‘IN HOUSE VIDEO” and press and unpress the “HIDE/SHOW”. The menu disappears most of the time, but if you keep selecting different movies, and pressing “HIDE/SHOW”, eventually you’ll see a large grey box appearing when the menu should be hidden.

The JavaScript code:

  • 1. The code to show/hide this section is pretty standard and works with IE and much of the time in Firefox. It is:
  • function showhide(ID) {
    var el = document.getElementById(ID);
    if ( el.style.display != “none” ) {
    el.style.display = “none”;
    }
    else {
    el.style.display = “”;
    }
    }

  • 2. This function is called by pressing the HIDE/SHOW button in the menu on the right hand side. I used document.write so that some of the menu items can change:
  • var txt='<div align=”center” style=”margin-top:6px; margin-bottom:20px”>’;
    txt += ‘<input name=”hide/show” type=button style=”background-color:#333333; color:#ababab; font-size:10px”‘;
    txt += ‘onclick=”showhide(‘menuwrapper’)” value=”Hide/Show” />’;
    txt += ‘</div>’;
    txt += ‘<div class=”subheader”>GALLERIES &amp; SLIDESHOWS</div>’;
    ….
    ….
    document.write(txt);

  • 3.

    The HTML code where the collapsible DIV is:
    <div id=”menuwrapper”>
    <script type=”text/javascript”>fleximenu(checkchannel())</script>
    </div>

  • 4.

    The fleximenu() function in part(3) calls a flash .swf file which displays the scrolling menu.

  • Intermittent errors are so difficult to track down, but in the interests of having this work with Firefox, I really want to find the answer. If any of the forum members have even a hint of an idea of a solution, I’d love to hear from you.

    Chris

    to post a comment
    JavaScript

    0Be the first to comment 😎

    ×

    Success!

    Help @chris2008 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.16,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...