File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes howto detect which button is click Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "howto detect which button is click" Watch "howto detect which button is click" New topic
Author

howto detect which button is click

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
hi , good day ..let assume i have ten buttons as follow, how can i know which button was pressed ?



thank you
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6
Add an onclick handler?
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
eric, i want when user click the button , then we can get the button name which have been clicked
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6
The easiest approach is adding an onclick handler



that stores the value in a variable.

The other approach is the following, I am not sure if it is crossbrowser friendly, have not tried it.



Eric
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
thanks , eric
 
jQuery in Action, 2nd edition
 
subject: howto detect which button is click
 
Similar Threads
"Edit in Place" Using Simple JS
Multiple Forms and Radio Buttons
Form input type=hidden - is it possible to set values dynamically
Getting html form name
parameter to servlet