Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: onclick event

  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    onclick event

    Hi,

    Not an expert but could use some understanding and confirmation regarding the use of onclick event handlers.

    I've worked with them on many occasions, but my question if an HTML tag currently has an onclick event and I need to add another, can I just simply add another onclick?

    Example

    <a href="/files/Registration_Form.doc" onClick="javascript: pageTracker._trackPageview('/downloads/Registration_Form_Universal'); onclick="javascript:this.form-just a sample">here</a>

    Is this possible to do?

    Thanks!

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,734
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    No, but a single onclick event can trigger multiple functions or actions:-

    <a href = '/files/Registration_Form.doc' onclick = 'doThis();doThat()'>Click Here</a>


    javascript: is not necessary


    "Simon is tying his shoelaces to the left of the umpire's chair." - Tennis commentator


  •  

    Posting Permissions

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