Błąd IE Javascript: „target” jest zerowy lub nie jest obiektem

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);
            }
        }
    }
}

Daje mi to błąd tylko w IE 8:

„target” ma wartość null lub nie jest obiektem

dla tej liniivar tagName = event.target.tagName;

Jak to naprawić. Błąd występuje po naciśnięciu klawisza Ctrl lub strzałek.

questionAnswers(2)

yourAnswerToTheQuestion