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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Layers are not hidden when I run this script.

    I have a page that will populate a one of 3 radio buttons at load time. I would like to 'show' one of 3 layers and 'hide' the other 2. I thought this short code would work, but the layers aren't hidden.

    function radioCheck(){

    if (document.forms[0].rd[1].checked == true)
    {
    document.getElementById[table2].visibility = "show";
    document.getElementById[table1].visibility = "hide";
    document.getElementById[table3].visibility = "hide";
    }
    }
    // -->
    </script>
    </head>
    <body onLoad="radioCheck()">
    <form name="radioform">
    <input type="radio" name="rd" value="one">one
    <input type="radio" name="rd" value="two" checked>two
    <input type="radio" name="rd" value="three"> three
    </form>
    <div id="table1">table one</div>
    <div id="table2">table two</div>
    <div id="table2">table three</div>

    Thank you so much, I have already enjoyed many psting here.
    eshera

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    document.getElementById('table2').style.visibility = "visible";
    document.getElementById('table1').style.visibility = "hidden";
    document.getElementById('table3').style.visibility = "hidden";

    and you have a typo here:

    <div id="table2">table two</div>
    <div id="table2">table three</div


  •  

    Posting Permissions

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