本文共 692 字,大约阅读时间需要 2 分钟。
图片预览
_this:input[file]对象
_thisNext:下一个要操作的DOM对象
cb:回调函数
function changeImg(_this, _thisNext, cb) { var reader = new FileReader(); reader.readAsDataURL(_this.files[0]); reader.onload = function(e) { _this.nextSibling.src = e.target.result; if (cb) { cb(_thisNext); } }; }
技术说明:
转载地址:http://lohi.baihongyu.com/