Forum Moderators: open

Message Too Old, No Replies

Is there a way to bind a key press to a click of a button?

effectively making the browser like a regular windows interface

         

rfung

7:01 pm on Jan 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



this only needs to work in IE5+

sort of like when you press the 'enter/return' key and it submits a form. I was wondering if there was a way to bind keys (or combos of keys) to functions. Why?

well, I have a page that has 4 functions - I'd like to have my users press CTRL+1(2,3,4) to access each link, rather than scrolling up and down and clicking them. The users have to enter thousands of entries and the clicking up and down is really a wasted effort.

txbakers

7:10 pm on Jan 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can capture which keys were pressed, including the F-Keys or Ctrl + keys, and you can write javascript events to do something when those keys are pressed.

There is a javascript function called "onKeyPress" and you need to get the "Keycode" .

Search for these functions out at a javascript repository and you'll find something.

mbauser2

8:49 am on Jan 30, 2004 (gmt 0)

10+ Year Member



If you're willing to use ALT instead of CTRL, you can do it with the accesskey attribute [cs.tut.fi].