More than one JS call in a link?

Discussion in 'JavaScript' started by Whogan, Feb 3, 2010.

  1. #1
    Hi all --

    I'm just getting my feet wet in JS, and I have a gallery site in which images are switched through a small JS function. But I'd also like to enable each of those links to be recognized as events in Google Analytics which, as I understand it, is also a JS call.

    Is there a way to call two JS functions in a single link? Or do I need combine both functions into a single function call?

    As you can see, I'm a beginner at these things, so thanks for being patient with the newbie question.

    -- Dave
     
    Whogan, Feb 3, 2010 IP
  2. hi-duke

    hi-duke Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    like this?
    --------------

    function a(){
    alert("A");
    }

    function b(){
    alert("B");
    }

    ---------
    <a href="javascript:a();b();">Call two JS functions in a single link</a>
     
    hi-duke, Feb 3, 2010 IP
  3. Whogan

    Whogan Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Like that!

    See, I told you I was a beginner :) I tried searching, honestly I did, but I think it was such a basic thing that it was hard to track down.

    Thanks very much!
     
    Whogan, Feb 4, 2010 IP