Display a submenu of a menu rollover based on page

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Display a submenu of a menu rollover based on page

Post 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
User avatar
Vincent Puglia
Forum Commoner
Posts: 67
Joined: Thu Sep 04, 2003 4:20 pm
Location: where the World once stood

Post 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
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Display a submenu of a menu rollover based on page

Post 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
User avatar
Vincent Puglia
Forum Commoner
Posts: 67
Joined: Thu Sep 04, 2003 4:20 pm
Location: where the World once stood

Post 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
Post Reply