PDA

View Full Version : Show/hide div on page load



denno020
23 Dec 2009, 10:57 PM
Hi all,

I was just wondering how I could show/hide certain divs on loading a new page of my website. Here is what I'm after:

I have a menu that is added to each page of my site via a dreamweaver library. Some of the pages have sub pages, and the way I'd like for those sub links to be displayed is that when a user is on a page with sub pages, there is a tree like structure that reveals under the menu option for the page that the user is on.
Best way to describe would be via an example:
Say I have 5 pages, page 1, page 2 etc.
One page 2, there is sub pages, Page 2a, Page 2b, Page 2c.
When the user clicks onto the link in the menu for page 2, I would like page 2 to load (as it has unique content on it), and then the div that will house the links to the sub page will become visible in the menu structure, under directly under the link for Page 2 (I will use a css class to style it differently with a smaller font to make it obvious that these are sub pages).
For this to work for navigation between websites, I'd also need to set the other sub page divs to hidden, so that there isn't any confusion. The result i'm after is the main link (which will toggle visibility) will also link to page 2.

How could I go about doing this?

If what I'm after isn't very understandable, please let me know and I'll try and give a clearer example

Thanks in advance :)

Denno.

EDIT:
I should have also added that I would like to keep the use of the dreamweaver library function as it makes it easy to update the menu for all of my pages, so I won't be able to create the extra menu items just for the pages they're needed on, all the menu items will need to be on all of the pages, however some will be hidden.