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
    Regular Coder
    Join Date
    Jun 2002
    Location
    United Kingdom Confused: Often
    Posts
    859
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problems with hiding/showing things

    hi, hopefully someone will be able to help...

    ive used this script:
    Code:
    function menu(f){
    if(f){visi="visible";}
    else{visi="hidden";}
    if(document.layers){
    document.menu.visibility=visi;
    }
    if(document.all){
    document.all.menu.style.visibility=visi;
    }
    if(document.getElementById){
    document.getElementById("menu").style.visibility=visi;
    }
    }
    to hide or show menus for ages and it has never failed me... but i was trying to add something to it so it would be able to show/hide differant layers (eg: menu(1,'moose'); to show a layer cunningly named "moose") but it didnt work. here's how i amended the above script:
    Code:
    function menu(f,which){
    if(f){visi="visible";}
    else{visi="hidden";}
    if(document.layers){
    document.which.visibility=visi;
    }
    if(document.all){
    document.all.which.style.visibility=visi;
    }
    if(document.getElementById){
    document.getElementById(which).style.visibility=visi;
    }
    }
    any ideas why this doesnt work? any help would be much appreciated
    redhead

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    well, i don't know if this is all of the problem ( i suspect that it's not ), but :

    function menu(f,which){
    if(f){visi="visible";}
    else{visi="hidden";}
    if(document.layers){
    document.layers[which].visibility=visi;
    }
    if(document.all){
    document.al[which].style.visibility=visi;
    }
    if(document.getElementById){
    document.getElementById(which).style.visibility=visi;
    }
    }
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts
    which is a reserved word
    USA

  • #4
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    that would definitely be another part of the problem. good call
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    United Kingdom Confused: Often
    Posts
    859
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks guys, i had expected it might be that simple.

    thanks again,
    redhead


  •  

    Posting Permissions

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