Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seeking ideas from multi-lingual programmers

Status
Not open for further replies.

Muddmuse

Programmer
Jul 31, 2001
85
0
0
US
I have and ASP driven site with a menu structure written in XML/XSL. This menu contains a list of "Chapters". Clicking on a Chapter would display a list of "Pages" within that Chapter. This is done with DHTML (show/hide div tags using the onclick event of the link - no reloading of the window). Also on this page are "Previous | Next" links that toggle thru the pages in a linear fashion, reloading the window with the appropriate page. All of this works fine. My dilemma is this:

When a page is loaded I expand the Chapter that the current page is part of and collapse all the other Chapters. I'd like to be able to maintain the state the user left the Chapters in from page to page. I'm stuck on how to get the expand/collapse logic (done in DHTML, not reloading pages) to merge with the XML menu. Any ideas?
 
Ok, my idea:
With javascript you could check which div's are shown and which are hidden.
On the previous & next links add a javascript function (client-side, no reload of your page) that checks for the div tags that are currently open (loop through all existing divs and check the state) and stores the necessary information in a variable. At the end of the function you redirect to the next page (or previous page) giving the variable in the url string (e.g. nextpage.asp?openDivs=2-6-13).
Then on the new page you check the string containing the variable and you use another javascript function to unhide the desired div tags.

The only hard thing is how to get and set the state of your div's. It depends on the DHTML menu structure. You'll need an ID for every div tag and you'll want to find out how exactly the divs are shown or hidden width javascript (most likely it will be with the 'style.display' method).

hope this helps,
greetings
 
Thanks for your reply. Believe it or not, your very same suggestion came to me in a dream, or was it a nightmare! and it worked great.

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top