how to not hide a division

Discussion in 'Javascript' started by richard, Nov 2, 2008.

  1. richard

    richard Guest

    In using the simple code below, how do I tell it NOT to hide a
    division when the link is clicked on if that division is already
    visible?

    would it be as simple as using a 2nd function and setting that to
    "display" rather than "none"?

    For instance, "home" is showing. The user clicks on "home".
    I don't want the division to do anything at all.


    function ShowHide(){

    if (document.getElementById('hide2').style.display ==
    document.getElementById('home1').style.display){
    document.getElementById('hide2').style.display = "none";
    } else {
    document.getElementById('hide2').style.display =
    document.getElementById('home1').style.display
    }
    }
    richard, Nov 2, 2008
    #1
    1. Advertising

  2. richard

    SAM Guest

    Le 11/2/08 10:27 PM, richard a écrit :
    > In using the simple code below, how do I tell it NOT to hide a
    > division when the link is clicked on if that division is already
    > visible?
    >
    > would it be as simple as using a 2nd function and setting that to
    > "display" rather than "none"?
    >
    > For instance, "home" is showing. The user clicks on "home".
    > I don't want the division to do anything at all.
    >
    >
    > function ShowHide(){
    >
    > if (document.getElementById('hide2').style.display ==
    > document.getElementById('home1').style.display){
    > document.getElementById('hide2').style.display = "none";
    > } else {
    > document.getElementById('hide2').style.display =
    > document.getElementById('home1').style.display
    > }
    > }
    >
    >


    don't know too much what could be this 'division' ...

    function ShowHide(){
    var home = document.getElementById('home1').style;
    var hide = document.getElementById('hide2').style;
    hide.display = home.display==''? hide.display :
    hide.display==''? 'none' : '';
    }

    function ShowHide(){
    var hide = document.getElementById('hide2').style;
    if(document.getElementById('home1').style.display != '')
    hide.display = hide.display==''? 'none' : '';
    }

    --
    sm
    SAM, Nov 2, 2008
    #2
    1. Advertising

  3. richard

    Doug Gunnoe Guest

    > don't know too much what could be this 'division' ...

    I didn't see the term 'division' in regard to 'div' in HTML 4
    specification, but I think that most assume that's what it means.
    Doug Gunnoe, Nov 3, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jive
    Replies:
    5
    Views:
    277
    Peter Hansen
    Nov 28, 2004
  2. Replies:
    94
    Views:
    4,390
    ¬a\\/b
    Feb 9, 2007
  3. karthikbalaguru
    Replies:
    38
    Views:
    8,777
    Dik T. Winter
    Mar 9, 2009
  4. Jurjen de Groot
    Replies:
    0
    Views:
    293
    Jurjen de Groot
    May 19, 2008
  5. richard

    show/hide any division

    richard, Oct 26, 2008, in forum: Javascript
    Replies:
    2
    Views:
    77
    David Mark
    Oct 28, 2008
Loading...

Share This Page