By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,630 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,630 IT Pros & Developers. It's quick & easy.

Revealing hidden html text

P: n/a
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.
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.

--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #2

P: n/a
Can you expand a little on display stylesheet attribute - not familiar.

Thanks.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.