Hiding layers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason & Juli Cook

    Hiding layers

    I have a layer containing a table. The layer is inside a centered
    containing table. If the layer is hidden, I want the form (surrounding
    table) to collapse. I want to toggle this effect with a checkbox. I can
    get the layer to come on, but not toggle. Also, it starts as hidden and
    there is a big gap where the table should be. What do I do?

    For the javascript, I've tried different versions of the following:
    function ChangeState(){
    if(document.get ElementById(myC heckBox).checke d){
    theForm.myLayer .style.display= 'block';
    }
    }

    My div tag works:
    <div id="myLayer" style="display: none;">

    My checkbox tag includes the following:
    onClick="Change State();"


  • Martin Honnen

    #2
    Re: Hiding layers



    Jason & Juli Cook wrote:

    [color=blue]
    > For the javascript, I've tried different versions of the following:
    > function ChangeState(){
    > if(document.get ElementById(myC heckBox).checke d){
    > theForm.myLayer .style.display= 'block';
    > }
    > }
    >
    > My div tag works:
    > <div id="myLayer" style="display: none;">
    >
    > My checkbox tag includes the following:
    > onClick="Change State();"[/color]

    <input type="checkbox"
    onclick="change State(this);" ...>

    function changeState (checkbox) {
    var div;
    if (document.getEl ementById &&
    (div = document.getEle mentById('myLay er'))) {
    div.style.displ ay = checkbox.checke d ? 'block' : 'none';
    }
    }

    --

    Martin Honnen

    Comment

    Working...