Revealing hidden html text

A

Andrew

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.
 
F

Fabian

Andrew hu kiteb:
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>

use the display stylesheet attribute instead of visibility. That way,
screen space is not reserved for the object.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top