• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accelerator/Mnemonics

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there an easy way to create Accelerator or Mnemonic keys on a Web form for the Buttons? I only need to worry about IE if that makes a difference.
 
James Swan
Ranch Hand
Posts: 403
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the attribute is "accesskey"
eg.
<input type="button" accesskey="1" ... />
then you should be able to get to that button with alt-1
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is more info on the access key
http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.11.2
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Groovy. Thanks guys.
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, from what I can tell, and a little testing, the only thing an accesskey does for a Button is put focus on the Button. So I would have to do ALT-B and then hit enter. I would like to hit ALT-B and the page be submitted. The only other way I guess is to use an Image for the button and do it as a link because I know an accesskey actually follows the link. But then I don't know if just clicking a link will actually perform a POST for the form.
Anyone have any suggestions?
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nevermind. I was doing it wrong.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also do it with key codes/ key press and catch it that way..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic