Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    2 divs out of six won't show up with show/hide

    Hello. I've got two divs that won't work with the ShowContent / HideContent
    Javascript function, but the others work fine. I've gone over and over the lines for typos, unclosed brackets, etc., and I can't find any. My header function is this:

    script type="text/javascript" language="JavaScript"><!--
    function HideContent(d) {
    document.getElementById(d).style.display = "none";
    }
    function ShowContent(d) {
    document.getElementById(d).style.display = "block";
    }
    function ReverseContentDisplay(d) {
    if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
    else { document.getElementById(d).style.display = "none"; }
    }
    //--></script>

    ...my line commands (in a href links) are like this:

    javascript:ShowContent('Goalx'); HideContent('Goal2'); HideContent('StrategicPlan'); HideContent('Vision'); HideContent('Mission') HideContent('Goal3'); HideContent('Goal4'); HideContent('Goal5'); HideContent('Goal6')"

    ...and my style in my (absolutely positioned) divs includes "display: none;" in all cases.

    What am I doing wrong? 7 out of 9 links show and hide fine. The other two ('Goalx') and ('Goal3') don't show at all. I'm completely stumped. Any help would be HUGELY appreciated. Thanks, jb.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,864
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Have you used a same id value for two different divs? (If so you will get some error)

    Or sometimes these two divs are positioned below others.
    Last edited by abduraooft; 06-14-2007 at 05:51 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    All my IDs are unique. As far as positioning goes, I have no z-index value for any of them. Is that a problem? Also, I was wondering about spacing - does the height value have to be exactly right or something? I've been at this a couple of days now. Arg! I appreciate your help.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You missed the semicolon between 'Mission' and 'Goal3'.
    Code:
    javascript:ShowContent('Goalx'); HideContent('Goal2'); HideContent('StrategicPlan'); HideContent('Vision'); HideContent('Mission'); HideContent('Goal3'); HideContent('Goal4'); HideContent('Goal5'); HideContent('Goal6')
    Check the Javascript console for error messages.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Boy do I feel silly.

    Thank you guys so much! Next time I'll have a real coding question instead of just typos. You guys rock. Next!


  •  

    Posting Permissions

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