Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: dynamic menu?

  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Scotland
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts

    dynamic menu?

    i'm trying to build a menu system.
    pretty simple stuff, the user will click on the appropriate option (1 thru 6) and the name of that option will be highlighted and the appropriate text will display in a section below.

    any suggestions?

    I could use an i-frame here, but would prefer something more DHTML-like.
    My body's a temple... and like those ancient Greek ones it's a ruin
    sweenster.co.uk

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Scotland
    Posts
    407
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oops! never mind - solved the problem.



    for anyone thats interested, i adapted a script i found:

    Code:
    <html>
    <body>
    <!--Links used to initiate the sub menus. Pass in the desired submenu index numbers (ie: 0, 1) -->
    <a href="javascript:showit(0)">option0</a> | <a href="javascript:showit(1)">option1</a> | <a href="javascript:showit(2)">option2</a><br>
    
    <!-- Edit the dimensions of the below, plus background color-->
    <ilayer width=400 height=32 name="dep1" bgColor="#E6E6FF">
    <layer name="dep2" width=400 height=32>
    </layer>
    </ilayer>
    <div id="describe" style="background-color:#E6E6FF;width:400px;height:32px"></div>
    
    
    <script language="JavaScript1.2">
    
    /*
    Tabs Menu (mouseover)- By Dynamic Drive
    For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
    This credit MUST stay intact for use
    
    (Modified by Sweenster 2004)
    */
    
    var submenu=new Array()
    
    //Set submenu contents. Expand as needed. For each content, make sure everything exists on ONE LINE. Otherwise, there will be JS errors.
     
    submenu[0]='content option 0 here'
    
    submenu[1]='content option 1 here'
    
    submenu[2]='content option 2 here'
    
    
    /////No need to edit beyond here
    
    var menuobj=document.getElementById? document.getElementById("describe") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : ""
    
    function showit(which){
    thecontent=(which==-1)? "" : submenu[which]
    if (document.getElementById||document.all)
    menuobj.innerHTML=thecontent
    else if (document.layers){
    menuobj.document.write(thecontent)
    menuobj.document.close()
    }
    }
    
    function contains_ns6(a, b) {
    while (b.parentNode)
    if ((b = b.parentNode) == a)
    return true;
    return false;
    }
    
    </script>
    </body>
    </html>
    My body's a temple... and like those ancient Greek ones it's a ruin
    sweenster.co.uk


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •