SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    457
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    view + hide content by clicking link

    Hi all, I want to be able to hide and show content of my website by clicking on various heading links. i.e. by clickin on a specific heading, the info about that heading will appear under that heading. The content related to the heading is within a <div>.

    Has any1 got any javascript code that will hide/show the content of the <div>, depending on how many times the link header is clicked?

    Cheers

  2. #2
    Non-Member
    Join Date
    Sep 2006
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try this link
    http://haugland.ca/?p=tutorial&i=23

    or go to www.pixel2life.com and search for the term "hide"

  3. #3
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    457
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That tutorial helped me out no end. However, ive got a few extensions that id like to make to the code:

    1. Id like the menus collapsed when the website is loaded. Ive tried the following, but im getting no luck:

    The follwoing code is added to the top of the source file on a page of my web site:
    Code:
    <SCRIPT LANGUAGE="JavaScript">
         document.getElementById(idofadiv).style.display = "none"; 
    </SCRIPT>
    This does not collapse the menus. Any ideas?

    2. When I click on all of the menus on 1 page of my website except 1 -> all menus, except 1 are collapsed.

    When I click on one of the buttons under the extended menu, all of the other menus will suddenly become extended. Any ideas how I cna keep the collapsed menus sollapsed while working within the extended menu?

    Cheeers

  4. #4
    SitePoint Member parsonsgfys's Avatar
    Join Date
    Feb 2004
    Location
    Suffolk, UK
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's a pretty good tutorial on this here. It may be slightly different to the way you're doing it now but it works pretty good.

  5. #5
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    457
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    one problem with the tutorial that you mentioned, it requires a <body> tag.

    Because im using a web control (.aspx) file, this does not contant a <body> tag, and if I try to entere one, an error will appear.

    Any other ways I could go about this?


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
  •