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') };
}
精彩评论