在使用ExtJS4的过程中,发现单击Backspace时,页面会出现回退的现象,严重影响了用户的体验,现给出以下解决方案
思路:当事件对象的target为document时禁用Backspace
代码: (Ext.isIE ? document: window).onkeydown = function(event) {
var e = Ext.isIE ? window.event: event;
var type = Ext.isIE ? e.srcElement.type: e.target.type;
if (e.keyCode === 8 && ! type) {
return false;
}
};