Calling a menu item from Javascript

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
tjw2006
Beginner
Beginner
Posts: 3
Joined: Fri Mar 09, 2007 12:35 pm

Calling a menu item from Javascript

Post by tjw2006 »

Hi, does anyone know if it's possible to emulate the onclick event of a menu item from Javascript - so basically firing the function within the correct .js script to redirect to a URL for instance?

Thanks in advance.
Tim
tjw2006
Beginner
Beginner
Posts: 3
Joined: Fri Mar 09, 2007 12:35 pm

hmmm....

Post by tjw2006 »

Has anybody got any ideas at all on how to do this?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I don't understand what you are asking. Do you want to put a onclick event in an html link? Or do you want to open a submenu from an html link onclick?

Ruth
tjw2006
Beginner
Beginner
Posts: 3
Joined: Fri Mar 09, 2007 12:35 pm

Wel...

Post by tjw2006 »

...all I want to be able to do is to simulate the click event of a menu item from a Javascript function.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I still am not sure what you want to do, but you can use the offfunction/onfunction to activate a function on mouseover which is this sample.

http://milonic.com/menusample15.php

You can also set up a function to be activated when you click a link in the menu. For example, you could have a new window function such as

Code: Select all

var newwindow; 
function poptastic(url) 
{ 
   newwindow=window.open(url,'name','height=500,width=400,left=100, 
  top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes'); 

} 
Then in the aI string you'd put this in the url= area

Code: Select all

url=javascript:newwindow('http://whatever/');");
Ruth
Post Reply