How can I prevent Backspace from navigating back in javascript?

后端 未结 4 1324
天涯浪人
天涯浪人 2021-02-02 17:00

This works in IE, but I cannot get it to work in Opera or Firefox. I want to prevent Backspace from navigating away if and only if the current focus is the SELECT dropdown.

4条回答
  •  猫巷女王i
    2021-02-02 17:46

    Well, turns out that Opera needs the event to be cancelled in the onkeypress event, not onkeydown.

    Reference: http://jimblackler.net/blog/?p=20

提交回复
热议问题