0

パラメータ e は、Chrome、FF、および IE 9 では正しいイベントですが、IE 8 および IE 7 では「未定義」です。F12 devtools を使用して IE 9 で再現可能です。ブラウザ モード: IE 8 およびドキュメント モード: IE 8 も同様です。

注:関数は、 e が未定義であるという私の「唯一の」問題として適切に呼び出されます...

<script>
    document.onmouseover = function(e) {
    // parameter e is the correct event in Chrome, FF and IE 9
    // but 'undefined' in IE 8 and IE 7. Reproducable in IE 9 using F12 devtools
    // Browser Mode: IE 8 and Document Mode: IE 8 also.
    // NOTE: The function is called properly my 'only' problem that e is undefined

    ... work with parameter e here
}
</script>

何か案は?事前に

4

1 に答える 1

2

IE ではイベントの処理が異なるため、動作しないのはなぜですか。

document.onmouseover = function(e) {
  e = e || window.event;
}
于 2013-03-08T15:21:17.520 に答える