Javascript AJAX对象IE8错误

Javascript AJAX对象IE8错误,javascript,ajax,internet-explorer,Javascript,Ajax,Internet Explorer,使用下面的代码,我得到了错误: 消息:未实现。 行:this.xmlHttpRequestObject.onreadystatechange=onreadystatechange ajax.js function Ajax(url, method, onreadystatechange, asynchronous) { this.xmlHttpRequestObject = new XMLHttpRequest(); this.method = method; this.

使用下面的代码,我得到了错误:

消息:未实现。 行:this.xmlHttpRequestObject.onreadystatechange=onreadystatechange

ajax.js

function Ajax(url, method, onreadystatechange, asynchronous) {
    this.xmlHttpRequestObject = new XMLHttpRequest();
    this.method = method;
    this.url = url;
    this.asynchronous = asynchronous === undefined ? true : asynchronous;
    this.xmlHttpRequestObject.onreadystatechange = onreadystatechange;
}

Ajax.prototype.send = function () {
    this.xmlHttpRequestObject.open(this.method, this.url, this.asynchronous);
    this.xmlHttpRequestObject.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
    this.xmlHttpRequestObject.send();

    return this;
};

Ajax.prototype.onreadystatechange = function (onreadystatechange) {
    this.xmlHttpRequestObject.onreadystatechange = onreadystatechange;

    return this;
};

Ajax.prototype.onloadstart = function (onloadstart) {
    this.xmlHttpRequestObject.onloadstart = onloadstart;

    return this;
};

Ajax.prototype.onload = function (onload) {
    this.xmlHttpRequestObject.onload = onload;

    return this;
};
scripts.js

function loadPage(page) {
    var ajax = new Ajax(page, 'GET');

    ajax.onloadstart(function () {
        var div = document.createElement('div'),
            p = document.createElement('p'),
            img = document.createElement('img'),
            section = document.querySelector('section');

        removeChildrenElements(section);
        section.style.minHeight = '230px';

        div.setAttribute('id', 'loading');

        img.setAttribute('src', 'media/images/loading.gif');
        img.setAttribute('alt', 'Carregando');

        p.appendChild(document.createTextNode('Carregando. Por favor, aguarde ...'));

        div.appendChild(p);
        div.appendChild(img);

        document.querySelector('section').appendChild(div);
    });

    ajax.onreadystatechange(function (event) {
        if (this.readyState === 4 && this.status === 200) {
            document.querySelector('section').innerHTML = this.responseText;
        } else if (this.status === 404) {
            this.abort();
            document.location = 'http://www.mydomain.com.br/404';
        }
    });

    ajax.send();
}
该脚本在Firefox4、Google Chrome和Opera中工作。
谢谢。

可能与窗口/文档对象冲突。尝试将代码更改为

Ajax.prototype.onreadystatechange = function (readystatechange) {
    this.xmlHttpRequestObject.onreadystatechange = readystatechange;
    return this;
};

我不明白。。。错误是指向Ajax构造函数,我有下面这个方法。。。谢谢。你看到我重命名了一个变量吗?对不起,参数。。。我要去试一下,不行。与窗口/文档对象冲突?为什么?非常感谢。