Click event not firing

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
jsmotherman
Beginner
Beginner
Posts: 3
Joined: Fri Oct 12, 2007 8:30 pm

Click event not firing

Post by jsmotherman »

I need to capture the window.event in javascript, but when I add "clickfunction=alert(window.event)" or "url=javascript:alert(window.event)" to a menu item I get "undefined" as the message. Does any window event fire when clicking the menu?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: Click event not firing

Post by Ruth »

Hi,

I think undefined is saying that the function is underfined. I'm not sure how you would capture a window event from the menu. If you clicked on the menu, it would be a click on the menu.

Put this at the top of your data file

Code: Select all

function theFunction(theParameter) 
{ 
  alert(theParameter); 
} 
Then the aI string could be any of the following
Uses url=javascript:

Code: Select all

aI("text=This has a js function in the url;url=javascript:theFunction(1);");
uses clickfunction

Code: Select all

aI("text=This has a js function when clicked;clickfunction=theFunction(2);");
uses type=html; and an image, you'll have to make your own image or no image and it will probably give you an x.

Code: Select all

aI("text=<IMG SRC='3.gif' WIDTH='50' HEIGHT='15' BORDER='0' ALIGN='Top' onclick='theFunction(3)'>;type=html;");
There is a demo for a function to test if the main menu is drawn before any of your routines are run called Set Time Out here http://support.milonic.com/demos/

Hope this helps.

Ruth
jsmotherman
Beginner
Beginner
Posts: 3
Joined: Fri Oct 12, 2007 8:30 pm

Re: Click event not firing

Post by jsmotherman »

Thanks. I am very familiar with the methods you posted. My problem is that I am using Webtrends for analytics on my site. Webtrends has provided me with code that listens for and captures all window events (i.e. click events) and logs them appropriately - I cannot alter their code. This works fine for everything on my site except for the Milonic menu. I'm just trying to figure out why clicking on the menu is not a click event.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: Click event not firing

Post by Ruth »

Hi,

I will post to Milonic about this. This is really beyond my knowledge, way beyond it. Maybe it's because the menu is a separate object? I wonder if you put the function you're using in the menu data file, also? since the message is the 'undefined' Then again, what do I know? As Schultz says "I know nothing" :lol: As you can see I'm just grabbing things and guessing. Though I'm posting to Milonic I think you will need to contact them. They are problably going to have to do some testing of the webtrends thing and the menu which we cannot do here on the forum.

Ruth
jsmotherman
Beginner
Beginner
Posts: 3
Joined: Fri Oct 12, 2007 8:30 pm

Re: Click event not firing: Solution

Post by jsmotherman »

Thanks, Ruth.

I just got it to work by using HTML as follows:
aI("text=<a href="http://websites.milonic.com/f=http:indy.org>Indianapolis</a>;type=html;");

Notice there's no need for any functions. Keeping it simple solved the problem.

Thanks again for all of your help.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: Click event not firing

Post by Ruth »

Hi,

That seems to imply that the Webtrends didn't read the url= as a hyperlink. Thanks for posting the solution in case anyone else needs it :)

Ruth
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Re: Click event not firing

Post by Andy »

Hi,

Which version of the menu are you using?

This used to be a problem with ealier versions until we added an actual link to the menu items.

I've just tried it with the latest version and Apache does add log records on our development server when a menu item is clicked on.

Cheers,
Andy
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Re: Click event not firing

Post by Andy »

After reading the first message again you mention clickfunction and url=javascript: - I'm not sure the browser will send anything to the server because using javascript to fire links is not makeing a new request to the web server because it's all happening on the client.

Real links should not be a problem, if they are, there must be something wrong.
Post Reply