SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist Tecknowjnkie's Avatar
    Join Date
    Nov 2004
    Location
    Mission Viejo
    Posts
    403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Is it possible to do two things onClick

    Example :

    onclick="function1, close.window()"

    TY

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,445
    Mentioned
    160 Post(s)
    Tagged
    1 Thread(s)

    multiple functions per event

    I don't know if you can reference a function like that - without the "()" - but you can call as many functions as you want with an event. Just seperate them with commas or semi-colons.

  3. #3
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Kent
    Posts
    1,921
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Create a new function.
    In it place two or more functions you wish to run, in the order you wish them to run.
    Make the new function the one that executes on the click.

  4. #4
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow

    onclick="function1(); function2(); function3();"

    Think of it the same way you would this:

    function onclick()
    {
    function1(); // Execute the first function
    function2(); // Execute the second
    function3();
    }

    // If this is function2, then function3 is never executed.
    // * You can use return false to stop a function from completing execution.
    function function2()
    {
    if(true)
    {
    return false;
    }
    }


Bookmarks

Posting Permissions

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