www.webdeveloper.com
Results 1 to 3 of 3

Thread: How to include 2 onclick event in a link?

  1. #1
    Join Date
    Mar 2011
    Posts
    39

    How to include 2 onclick event in a link?

    hello

    I have actually the follow link code inside the template of my site:

    Code:
    <a rel="noindex, nofollow" href="javascript:void(0);" onclick="showPhoneNo(this);return false;"><?php __t("Show phone number");?></a>
    Now I need to include in this same link code another Onclick event but I don't see how to write the full code with both events

    My new Onclick event is the following:

    Code:
    <a href="#" onClick="_gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First Birthday']);">Play</a>
    Somebody can help me to find how to mix both Onclick events in my link ? I tried some combinations but without success.

    Many thank

  2. #2
    Join Date
    Jan 2009
    Location
    Insanity
    Posts
    1,131
    HTML Code:
    <a rel="noindex, nofollow" href="javascript:void(0);" onclick="_gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First Birthday']); showPhoneNo(this); return false;"><?php __t("Show phone number");?></a>
    You stack them in the order in which you want the scripts elements to run. the onclick event is like saying

    Code:
    function(){
      _gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First Birthday']); 
      showPhoneNo(this); 
      return false;
    }
    Does that help?

  3. #3
    Join Date
    Mar 2011
    Posts
    39
    excellent this work well !!

    Many thanks for your great help...

    all the best

    cheers

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles