window.status ="";
function size(file){
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function(theFile) {
var image = new Image();
image.src = theFile.target.result;
image.onload = function() {
alert("图片的宽度为"+this.width+",长度为"+this.height);
if(this.width==1072 && this.height==400){
window.status = 'true';
}else{
window.status = 'false';
}
}
}
return window.status;
}
在另一个函数中调用该函数,alert到的返回值内容为空...求解怎么办?
如何定义全局变量,如何给变量再赋值呢?