document.onkeydown = function(event) {
var tagName = event.target.tagName;
if (tagName != 'INPUT' && tagName != 'TEXTAREA' && !event.alt && event.control) {
if (event.ctrlKey && event.keyCode == 37) {
if (_this.currentPage > 1) {
window.location.href = _this.baseUrl.replace(/%page%/i, _this.currentPage + 1);
}
} else if (event.ctrlKey && event.keyCode == 39) {
if (_this.currentPage < _this.pagesTotal) {
window.location.href = _this.baseUrl.replace(/%page%/i, _this.currentPage - 1);
}
}
}
}
這讓我只能在IE 8中的錯誤:的Javascript IE錯誤:「目標」爲空或不是對象
「目標」爲空或不是對象
爲line var tagName = event.target.tagName;
如何解決這個問題。當我按下Ctrl或箭頭按鈕時發生錯誤。
'event.target'不存在IE8。歡迎來到IE的舊事件系統。 –
請你舉例說明如何解決這個問題? – user1815131
使用第三方事件API來爲您處理跨瀏覽器不兼容問題。這將是我的建議。 –