This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Determining which button was clicked? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Determining which button was clicked?" Watch "Determining which button was clicked?" New topic
Author

Determining which button was clicked?

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
I have some JavaScript that, given the name of a button, I can call the appropriate JavaScript function (in the onClick()).

But, since I have multiple submit buttons on a form, I'd like to be able to have a single JavaScript function and then do different things in a single JavaScript button based on which submit button's name was clicked.

Is there a way to determine which button was clicked via the event model, DOM, or other way within a JavaScript function that's called by multiple submit buttons?

Thanks in advance.

Mike
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
Thanks Eric.

Are any of these type tips documented in any book you've written?

I can't seem to readily find them in any of the JS books I have.

Thanks again.

Mike
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Determining which button was clicked?
 
Similar Threads
How to give multiple actions in a single form?
Get the button value from request.getParameterValues()
Delegating requestes to different servlets based on the submission.
multiple submit buttons
how to call different java script codes on different button click