layer script modification

Discussion in 'Javascript' started by Rob, Jun 27, 2003.

  1. Rob

    Rob Guest

    I'm trying to make an adjustment to allow contentone to be visible when the
    page loads but I can't figure it out. Will anyone be so kind and help? I
    appreciate any assistance you can provide!

    TIA - Rob

    <script type="text/javascript">
    <!--
    function changeDiv(the_div,the_change)
    {
    var the_style = getStyleObject(the_div);
    if (the_style != false)
    {
    the_style.display = the_change;
    }
    }

    function hideAll()
    {
    changeDiv("contentone","none");
    changeDiv("contenttwo","none");
    }

    function getStyleObject(objectId) {
    if (document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
    return document.all(objectId).style;
    } else {
    return false;
    }
    }
    // -->
    </script>

    <form>
    <input style="border-style:none;" type="radio" name="HardDrive"
    onClick="hideAll(); changeDiv('contentone','block');">Content One<br>
    <input style="border-style:none;" type="radio" name="HardDrive"
    onClick="hideAll(); changeDiv('contenttwo','block');">Content Two<br>
    </form>

    <div id="contentone" style="display:none">
    content one
    </div>

    <div id="contenttwo" style="display:none">
    content two
    </div>
     
    Rob, Jun 27, 2003
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.