View Full Version : Layers are not hidden when I run this script.

03-11-2004, 05:17 AM
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";
// -->
<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
<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.

03-11-2004, 05:52 AM
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