SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Sep 21, 2006, 01:56 #1
- 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
-
Sep 21, 2006, 01:59 #2
- 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"
-
Sep 21, 2006, 05:28 #3
- 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>
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
-
Sep 21, 2006, 09:09 #4
- 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.
-
Sep 22, 2006, 07:42 #5
- 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