I have a <div> section of text in my page that I want to make visible
via an input check box associated with an OnClick javascript.
I can do this OK but the problem is that the space for the hidden text
is reserved on the page (i.e. thare is a gap). The user clicks the
button to make the text visible or not visible.
What I really want is for the page to expand (open up) to reveal the
text if the user checks the box and contracts again if the box is
unchecked. 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.