Click to See Complete Forum and Search --> : Trying to tweak an existing script


shelton
11-06-2003, 03:21 PM
On this page:

http://williamlatimer.com/council/council2.htm

I am using a javascript for the expandable menu. I want the menu to retain it's 'state' as you navigate around.

The current page you see is a similation of a page called 'Submitting a Proposal' that would be nested within the site. But, as you can see, the menu does not expand 'onload' for the particular page you may be on. I have however, via css, highlighted the section you may be in, but you have to manually open that menu to see the location of the current page, which is bolded.

I am trying to add an if statement within the page source to cause a particular nested ul to display as well as adjust the state of the triggering link (the link with the plus sign, needs to be a minus sign and upon 'click' it should close up that menu).

But... I am JS challenged.

Here's my attempt, where function() refers to the linked javascript file called menuExpandable2.js.

I know of 2 problems with it: 1. actuator.onload (is this valid?) 2. all of the submenus share the class name 'menu' so I don't know how to tell it to expand that particular menu.


<script type="text/javascript">
<!--
if(window.location == "http://tlhweb014/council/council2.htm" {
actuator.onload = function() {
var display = menu.style.display;
this.parentNode.style.backgroundImage =
(display == "block") ? "url(i/menminus.gif)";
menu.style.display = (display == "block") ? "none" : "block";

return false;
}
}
//-->
</script>

96turnerri
11-06-2003, 03:36 PM
so basically you want one menu to close when another opens?, and when you click - it closes menu right?

shelton
11-06-2003, 03:53 PM
no... I want the menu to retain it's state as you navigate around.

so if you went to the homepage, opened up a menu and clicked on one of the choices, when you got to that page, the menu would show the respective section expanded. i.e. it retained the state in which you left it.

it's hard to articulate but it's a simple concept, and you've seen it before.

96turnerri
11-06-2003, 05:26 PM
if the menu were in a frame you would get that result

shelton
11-07-2003, 07:23 AM
ah... well... that's true, but I don't want to use a frame.

At this point I'm stuck in "I wanna make this work mode". Mostly because I may want to use it in the future.

I know it can be done, even with the existing script, I'm just to weak with JS to make it happen.

96turnerri
11-07-2003, 07:30 AM
well im good with js not a master but i can do some good stuff ill give it a go if i get some free time, real busy making a site atm sry

shelton
11-07-2003, 07:39 AM
Thanks -- any help is very appreciated.