design question

Giganews Newsgroups
Subject: design question
Posted by:  headwa… (headware)
Date: 11 Jul 2003

Hi, I have a general design questions. I'm making a site that has two
frames, one on the left for navigational menus and one on the right
for displaying the contents of the site. I want some of the menu items
on the left to expand dynamically and display sub items when the user
clicks on them. So they might show something like this:

item 1
item 2
item 3

then when you click on item 2 you get this:

item 1
item 2
  sub item 2.1
  sub item 2.2
item 3

I was going to put all the javascript in just the menu pages so that
when you click on one of the expandable menu items, it loads another
static page into the left frame with that menu item expanded. I know
that may not be the best solution especially if we decide to have more
than one expandable menu item, but that's the way it's going to work
for now.
  This would have worked fine except that some pages allow the user
to access other pages without using menu on the left. The problem
there is that if a page that isn't part of an expanded menu item takes
you to another page that *is* part of an expanded menu item, the menu
won't expand, since the javascript only runs if you click the menu
item hyperlinks in the left pane.
  This problem can be solved in at least a few ways. I could take the
javascript out of the menu pages and put it in the onLoad event of
every display page so that when that page displays, it changes the
left frame to display the proper menu for that page (expanded or
collapsed). Or I could connect the javascript to the hyperlinks that
move you from pages with collapsed menus to pages with expanded menus.
Neither of those solutions sounds all that good because every time you
right a new page you have to remember to put the javascript in there
if it's going to affect the menu frame. Is there any other way of
doing this that I might be missing? Something that won't turn into a
maintenance nightmare?