A
Andy
I have a <div> section in my page that I want to make visible via an input check box with OnClick javascript.
I can do this but the page reserves the space for the hidden class div and the user clicks the button to make it visble or nor visible.
What I really want is for the page to expand to reveal the div if the user clicks the box is checked and contracts again if the box is unchecked again. Much neater.
Here are the important bits of the code so far :-
<style type="text/css">.hidden { position: relative; visibility: hidden; }</style>
.............
<SCRIPT LANGUAGE="JavaScript">
function set(What,Value)
{
if (document.layers && document.layers[What] != null)
document.layers[What].visibility = Value;
else
if (document.all)
eval('document.all.'+What+'.style.visibility ="'+ Value+'"');
}
function click1(Form,Radio,Layer)
{
vv = "visible"
hh = "hidden"
if (Form.C1.checked)
{set(Layer,vv);}
else
{ set(Layer,hh);}
}
</SCRIPT>
...........
<td align="left" valign="top" width="100%"><input type="checkbox" name="C1" onClick="click1(this.form,this.name,'L1')" value="OFF"><div class="hidden" id="L1"><ul><li>xxx</li><li>yyy</li></ul></div></td>
Can you help?
Thanks.
I can do this but the page reserves the space for the hidden class div and the user clicks the button to make it visble or nor visible.
What I really want is for the page to expand to reveal the div if the user clicks the box is checked and contracts again if the box is unchecked again. Much neater.
Here are the important bits of the code so far :-
<style type="text/css">.hidden { position: relative; visibility: hidden; }</style>
.............
<SCRIPT LANGUAGE="JavaScript">
function set(What,Value)
{
if (document.layers && document.layers[What] != null)
document.layers[What].visibility = Value;
else
if (document.all)
eval('document.all.'+What+'.style.visibility ="'+ Value+'"');
}
function click1(Form,Radio,Layer)
{
vv = "visible"
hh = "hidden"
if (Form.C1.checked)
{set(Layer,vv);}
else
{ set(Layer,hh);}
}
</SCRIPT>
...........
<td align="left" valign="top" width="100%"><input type="checkbox" name="C1" onClick="click1(this.form,this.name,'L1')" value="OFF"><div class="hidden" id="L1"><ul><li>xxx</li><li>yyy</li></ul></div></td>
Can you help?
Thanks.