开发者

disabling scroll on arrow up and down

is there a wa开发者_StackOverflowy to disable scrolling when pressing the arrow up and down keys?


It is possible (see http://www.tek-tips.com/viewthread.cfm?qid=1262956&page=1), but please, for the love of God, limit it to the particular section where it's a problem.

The script would look something like this (taken from the link earlier):

<script>
if(window.Event) window.captureEvents(Event.KEYDOWN);

function keyDown(e){
  var n = (window.Event) ? e.which : e.keyCode;
  if(n==38 || n==40) return false;
}
</script>

<select onkeydown="return keyDown(event);" onmousewheel="return false">
<option>a
<option>b
<option>c
</select>

There are responsible applications for this idea. Please make sure yours is one of them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜