auto repeat the up/down arrow key?
in firefox when im inside a input textbox and press down the up/down arrow key it doesn't autorepeat. how can i make that happen and control how many keypress it will fire up per sec?
UPDATE: i use:
$('#search_view #search').live('keydown', function(event) {
if(event.keyCode == 40) {
// code开发者_JS百科
}
});
but it just execute the code one time..i would like it to repeat when holding down the down-arrow.
Use .keydown()
instead ..
quote from jQuery .keypress()
In addition, modifier keys (such as Shift) cause keydown events but not keypress events.
Arrows fall do not fall in the same category as Shift, but are treated in a special way ... the keydown will do the trick ..
Update
After your comment here is a sample that works in
- FF 3.5.x and 3.0.11
- IE 6, 7
- Google Chrome 4.0.x
- Safari 4.0.4
It only does not work on Opera (Edit: works on Opera 12.16) but it does not work with any key .. not just the arrows..
About the rate, you can not alter it from your code.. it is a system option (from BIOS and from keyboard settings in control panel -windows- )
精彩评论