Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
07-20-2011, 09:45 PM #1
- Join Date
- Oct 2010
- Thanked 0 Times in 0 Posts
Proper way to have two onclick events within one anchor tag?
OK, I'm filling in for a coworker on a radio stations website.
The station currently streams live online. I want to add an event tracking so I can track how many people are streaming. I'm really new to js, but I think I figured it out (keyword is "think"). However, there was already an onclick event within the anchor tag. Can I have two in the same tag? Is there a better way to do this?
<a href="/fmstream/listen.asx" onclick="window.open(this.href,'Listen','resizable=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no,dependent=no,width=400,height=400,status'); return false" onClick="pageTracker._trackEvent('Stream','Listen_Button','Stream_Live');"> <img src="/images/filecabinet/folder1/listen1.png" alt="listen1"></a>
07-20-2011, 10:49 PM #2
- Join Date
- Jun 2011
- Thanked 1 Time in 1 Post
You could just do something like:
rather than have two onClicks. It will then execute function1() followed by function2()Code:<a href="stuff" onclick="function1();function2();">
Last edited by klarosa; 07-20-2011 at 11:09 PM.
Users who have thanked klarosa for this post: