开发者

addEventListener with inexplicable undefined method error

I couldn't find an answer to th开发者_运维百科is problem I've been having.

function UploadBar() {
    this.reader = new FileReader();
    this.reader.addEventListener(
        "onloadstart"
        , function(evt) {alert("Hello World");}
        , false
    );
}

when I try to run this code it gives me an undefined_method_error in the javascript debugger in chrome. Could anyone be so kind as to tell me what is wrong here?


reader is not an element, so don't use .addEventListener Instead do the following.

function UploadBar() {
    this.reader = new FileReader();
    this.reader.onloadstart = function(e) { alert('Hello World') };  
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜