Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:22
OnClick Function Duplication
Poster: bobwill
Dated: Saturday February 9 2008 - 15:27:00 GMT
I am trying to duplicate the "onclick" function in the Milonic Menu
The following line of code is an example of the html code that I am trying to duplicate. Not the file or URL as shown in the example, but the process as shown.
<a href="http://www.example.com" onClick="javascript: pageTracker._trackPageview('/outgoing/example.com');">
Here is my Milonic menu code.
aI("text=New Helmet Rule;url=/forms/helmet_rule.doc;status=New Helmet Rule;separatorsize=1;");
Is the following line the correct Milonic replacement code?
aI("text=New Helmet Rule;url=/forms/helmet_rule.doc;clickfunction=javascript: pageTracker._trackPageview('/forms/helmet_rule.doc') status=New Helmet Rule;separatorsize=1;");
Re: OnClick Function Duplication
Poster: Ruth
Dated: Sunday February 10 2008 - 9:40:52 GMT
Hiya Bob,
Well, since I don't do much js, and since I'd need some kind of 'function' to test I can only say that to me it looks as if that should work. That is how you set up a click function, so if the function is available to be triggered by the click, then I would think that the url part of the aI would open the doc, and the click function part would trigger the function when you clicked to open the doc. If you can't get it to work and you don't get a more definitive response here in a bit, I can only suggest that you contact Milonic directly. I will try to find some function out on the web to use and set up a click function plus say a pdf file to open and see what happens.
Ruth
Re: OnClick Function Duplication
Poster: bobwill
Dated: Sunday February 10 2008 - 15:29:29 GMT
OK, thanks Ruth
This has to do with Google Analytics for me to track files that are being downloaded.
Re: OnClick Function Duplication
Poster: Andy
Dated: Friday February 15 2008 - 13:09:26 GMT
Hi,
You don't need the javascript: setting for clickfunction, you've also got a space in there, try this instead:
Code:
aI("text=New Helmet Rule;url=/forms/helmet_rule.doc;clickfunction=pageTracker._trackPageview('/forms/helmet_rule.doc');separatorsize=1;");
HTH,
Andy
Re: OnClick Function Duplication
Poster: bobwill
Dated: Friday February 15 2008 - 13:35:55 GMT
Thanks Andy. I will give it a try. I had already caught the blank space and replaced it with a semi-colon. I will remove the "javascript" statement and see how things go.
Re: OnClick Function Duplication
Poster: Shannon
Dated: Thursday February 5 2009 - 13:18:01 GMT
Did anyone every get this to work?
I am also trying to use Google analytics to track outbound traffic.
This non-Milonic link works fine:
Code:
<a target="_blank" href="http://www.tennis-warehouse.com/" onClick="javascript: pageTracker._trackPageview('/outgoing/advertisers/TennisWarehouse/mainmenu');">Tennis Warehouse</a>
This Milonic menu item does go the right page, but Google analytics does not pick up the link like in the example above.
Code:
aI("text=Tennis Warehouse;target=_blank;url=http://www.tennis-warehouse.com/;clickfunction=pageTracker._trackPageview('/outgoing/advertisers/TennisWarehouse/submenu');");
I clicked on each link 5 times. In Google analytics I see 5 visits to "'/outgoing/advertisers/TennisWarehouse/mainmenu" but none to "'/outgoing/advertisers/TennisWarehouse/submenu".
Thanks for the help.
Shannon