SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    toggle view script/ drop down/collapse

    hi
    I am searching for a script that would create a hidden drop down option for me such as

    toggle view script/ drop down/collapse

    e.g could be seen on the home page of this forum. When you click the plus sign e.g on databases

    Any assistance please ?

    Thanks
    AFrika

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML Code:
    <div id="bla" style="display:block" onClick="collapseObj(this.id)">
    <!-- content -->
    </div>
    Code:
    function collapseObj(numT) {
    var v = document.getElementById(numT).style.display;
    switch(v) {
    case "block":
    document.getElementById(numT).style.display = "none";
    break;
    case "none":
    document.getElementById(numT).style.display = "block";
    break;
    }
    }
    cheers

  3. #3
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot reminder
    however i am not too good with client side scripting and just am not getting it right.

    See code below

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <div id="bla" style="display:block" onClick="collapseObj(this.id)">
    <!-- content -->
    </div><script language="JScript">function collapseObj(numT) {
    var v = document.getElementById(numT).style.display;
    switch(v) {
    case "block":
    document.getElementById(numT).style.display = "none";
    break;
    case "none":
    document.getElementById(numT).style.display = "block";
    break;
    }
    }</javascript>
    </body>
    </html>

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript" language="javascript">
    function collapseObj(numT) {
    var v = document.getElementById(numT).style.display;
    switch(v) {
    case "block": document.getElementById(numT).style.display = "none"; break;
    case "none": document.getElementById(numT).style.display = "block"; break;
    }
    }
    </script>
    </head>
    <body>
    <input type="button" value="Collapse" onClick="collapseObj('bla')">
    <div id="bla" style="display:block">
    <!-- your div content here -->
    </div>
    </body>
    </html>
    cheers :

  5. #5
    Afrika
    Join Date
    Jul 2004
    Location
    Nigeria
    Posts
    1,737
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, thanks
    wud try it

  6. #6
    monitormensch oerdec's Avatar
    Join Date
    Sep 2004
    Location
    Hamburg
    Posts
    706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know, itīs an old thread... But I want to use such a function for a two level menu using an unordered list. My problem is the list collapses whenever I click a link. It should stay open.

    Any hints?

    oerdec


Bookmarks

Posting Permissions

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