Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

howto detect which button is click

 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add an onclick handler?
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
eric, i want when user click the button , then we can get the button name which have been clicked
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks , eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic