aspose 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
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: 15376
    
    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: 15376
    
    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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: howto detect which button is click