default layer selected?

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

    default layer selected?

    I'm using the script below to show/hide layers and I'm wondering how to make
    one layer display be default. Is there a way to make layer 0 display (or any
    layer) when the page loads? Thanks for any tips you can provide!

    TIA - Rob

    <script language="javas cript">
    <!--
    var currDivObj = null;
    function changeDIV(selOb j) {
    var divObj;
    selValue = selObj.options[selObj.selected Index].value;
    if (document.getEl ementById)
    divObj = document.getEle mentById("div" + selValue);
    else if(document.all )
    divObj = document.all("d iv" + selValue);
    else if (document.layer s)
    divObj = document.layers["div" + selValue];

    if(document.get ElementById || document.all){
    if(currDivObj){
    currDivObj.styl e.display = "none";
    }
    divObj.style.di splay = "block";
    }
    else if (document.layer s) {
    if(currDivObj){
    currDivObj.visi bility = "hidden";
    }
    divObj.visibili ty = "visible";
    }
    currDivObj = divObj;
    }
    // -->
    </script>

    <select name="sel1" onChange="chang eDIV(this)" class="formFiel d">
    <option value="0">Gener al Contact</option>
    <option value="1">Wealt h Management</option>
    <option value="2">Busin ess Electronic Services</option>
    <option value="3">Busin ess Services</option>
    <option value="4">Check Card Request</option>
    <option value="5">Club 50</option>
    <option value="6">Club 50 Trip Sign-Up</option>
    <option value="7">EIU Transfer Questions</option>
    <option value="8">Lendi ng</option>
    <option value="9">Onlin e Services</option>
    <option value="10">Pant her Card Request</option>
    <option value="11">Pers onal Banking Services</option>
    </select>


  • Martin Honnen

    #2
    Re: default layer selected?



    Rob Wahmann wrote:
    [color=blue]
    > I'm using the script below to show/hide layers and I'm wondering how to make
    > one layer display be default. Is there a way to make layer 0 display (or any
    > layer) when the page loads? Thanks for any tips you can provide![/color]

    Unless you want to build a page that depends on scripting to work you
    should start with having all layers visible in your static HTML/CSS and
    then you need to run through them to hide all but one with your script.
    Loop through your select (or with the values you have simply through 0
    to select.options. length - 1) and hide the elements.
    --

    Martin Honnen


    Comment

    Working...