Alternatives to onClick?

Page: 1

Author Post
flyingpylon
Guest
I understand that Floatbox takes over an element's existing onClick attribute. However, I'm wondering if there is any way to achieve the same result as an onClick action while still using Floatbox?

For example, I'm using the Google Analytics click tracking code which is:

onClick="javascript: pageTracker._trackPageview('yourpagename');"


and it doesn't appear to work on links that are Floatboxed.

I saw in another thread that it was suggested to use onRelease, but from what I can tell, that doesn't seem to work either (and I don't seem to be able to find it in any HTML documentation... is it really a valid attribute?).

Are there any other alternatives?

Thanks.
Administrator
Registered: Aug 2008
Posts: 3382
Sorry about the bad steer with onRelease. That's a flash/actionscript thing, not an html/javascript thing.

The best way to fire that tracking code is by assigning it to floatbox's onItemStart callback function. You'd put this in the rev option and it would look like this:
rev="onItemStart:`pageTracker._trackPageview('yourpagename');`"

(Don't omit the back-quotes.)

For completeness, I'll also mention that you could remove the floatbox class and then manage the onclick action like this:
onclick="pageTracker._trackPageview('yourpagename'); fb.start(this); return false;"

But onItemStart is probably the better choice.
flyingpylon
Guest
This works great... thanks! :)

Page: 1