Revealing hidden html text

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew

    Revealing hidden html text

    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="JavaS cript">

    function set(What,Value)
    {

    if (document.layer s && document.layers[What] != null)
    document.layers[What].visibility = Value;
    else
    if (document.all)
    eval('document. all.'+What+'.st yle.visibility ="'+ Value+'"');
    }

    function click1(Form,Rad io,Layer)
    {
    vv = "visible"
    hh = "hidden"
    if (Form.C1.checke d)
    {set(Layer,vv); }
    else
    { set(Layer,hh);}
    }
    </SCRIPT>

    ...........

    <td align="left" valign="top" width="100%"><i nput type="checkbox"
    name="C1" onClick="click1 (this.form,this .name,'L1')" value="OFF"><di v
    class="hidden" id="L1"><ul><li >xxx</li><li>yyy</li></ul></div></td>


    Can you help?
    Thanks.
  • Fabian

    #2
    Re: Revealing hidden html text

    Andrew hu kiteb:
    [color=blue]
    > 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>[/color]

    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!


    Comment

    • Andrew

      #3
      Re: Revealing hidden html text

      Can you expand a little on display stylesheet attribute - not familiar.

      Thanks.

      Comment

      Working...