Page 1 of 1

Display a submenu of a menu rollover based on page

Posted: Wed Sep 03, 2003 12:22 pm
by kendall
Hello,

I have created a javascript that onClick sets a display style of a div tag either show or hide a sub menu....

Is there a way that will allow the submenu to stay 'show' or hide based on the current page??

Kendall

Posted: Fri Sep 05, 2003 2:45 pm
by Vincent Puglia
Hi kendall,

In general, the answer is yes, but without seeing your code......?????

One possible solution: use a setTimeout() and check the current document.location against what you want.

if (document.location == "http://members.aol.com/grassblad")
...code to display div...

Vinny

Display a submenu of a menu rollover based on page

Posted: Fri Sep 05, 2003 3:02 pm
by kendall
Hello,

Well i created a solution where by i placed a

Code: Select all

var page = sub menu id
on each page

and did a

Code: Select all

onLoad ToggleMenu(page);
see... i was trying to do it that way originially but the thing is the i wanted the menu displayed if the current page was in 'group' thus i need to identify the group. having to do a location would mean i then have to trace it through the group. Im not a javascript person....so i took the easy way out :oops:

heres what i did....

Code: Select all

function toggleMenu(obj){
 if (parseInt(navigator.appVersion) >= 5 || navigator.appVersion.indexOfї"MSIE 5"] != -1){
 	if(obj.style.display !='none')
		obj.style.display = 'none';
	else obj.style.display = '';   
 }
}

var page = 'the menu';


<body onLoad = toggleMenu(page);>
embarassing...i know i know...but it works

Kendall

Posted: Fri Sep 05, 2003 3:07 pm
by Vincent Puglia
Hi Kendall,
Im not a javascript person....so i took the easy way out
if it works it works. beside, I don't see anything wrong with code.

Vinny