标签:files tor state targe event selector document ada fun
Obj.addEventListener("change",fun)
function fun(){
if (this.files && this.files[0]){
var imgSrc=document.querySelector("类"); //获取图片展示节点
var reader = new FileReader(); //判断图片是否加载完毕
reader.onload = function(evt){
if(reader.readyState === 2){ //加载完毕后赋值
imgSrc.src = evt.target.result;
}
}
reader.readAsDataURL(this.files[0]);
}
}
标签:files tor state targe event selector document ada fun
原文地址:https://www.cnblogs.com/xm16/p/10120561.html