onClick Javascript events

Page: 1

Author Post
myquealer
Guest
Is there a way to do something along the lines of executing our own javascript code with an onClick event?

In my particular case, I would like Google Analytics to track each time someone watches the video on our home page, which is in a floatbox. I tried adding onClick="pageTracker._trackPageview('/index.php/played_movie.flv')" to the anchor tag that opens the floatbox, but this seems to fail most of the time (confirmed by changing the onClick action to alert('clicked') ).

It would be nice if there were a callback function to execute our own code when someone opens or closes a floatbox....

Thanks,
Mike
Administrator
Registered: Aug 2008
Posts: 3382
Yup, floatbox takes over the onclick action, stomping on anything you might have set up there. So, for floatboxed anchors, you should assign your javascript action to the onrelease event. This will stay intact.

Callbacks for different floatbox actions (start, end, change) will be implemented in the next release. Stay tooned....
myquealer
Guest
Thanks for the reply. Of course, I should have thought of onRelease....

Instead I hacked Floatbox and added onOpen and onClose options which eval the javascript they are set to when opening and closing a floatbox. This is probably a big security hole. To close it, at least partway, I disabled Floatbox reading options from the query string.

Page: 1