Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    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>

  • #2
    New Coder
    Join Date
    Jun 2011
    Thanked 1 Time in 1 Post
    You could just do something like:

    <a href="stuff" onclick="function1();function2();">
    rather than have two onClicks. It will then execute function1() followed by function2()
    Last edited by klarosa; 07-21-2011 at 12:09 AM.

  • Users who have thanked klarosa for this post:

    javanewbie7 (07-21-2011)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts