memo:ie6でのJavaScriptエラー


ie6においてJavaScriptのコメントに日本語を使用してる場合、JavaScriptを読み込んでいるページとエンコードが違うとエラーがでる。

エンコードを合わせるか、指定して回避。

1
<script charset="utf-8" language="javascript">

それとIEでArray.indexOfが実装されて無いそうで、実装する。

1
2
3
4
5
6
7
8
9
10
if (!Array.indexOf) {
    Array.prototype.indexOf = function (target) {
        for (var i = 0; i < this.length; i++) {
            if (this[i] === target) {
                return i;
            }
        }
        return -1;
    }
}

No related posts.

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>