简体   繁体   中英

use alt + shift + a as a hotkey in IE 7/8

I am trying to attach an keyup listener on document object. I wanna know when user presses alt + shift + a or alt + shift + w . Both work in Chrome and Firefox. In IE, alt + shift + w works, but alt + shift + a doesn't. I know IE has few hot keys reserved, but why is taking over alt + shift combination, too? Is there a way to prevent this or is it a flow in IE?

Demo: http://jsfiddle.net/HnD5E/

Thanks

You can get around this behavior with a keydown event.

$(document).keydown(function (e) {
            if (e.keyCode == 65 && e.altKey) {
                 e.preventDefault();
            }
        }).keyup(...);

http://jsfiddle.net/HnD5E/4/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM