js图片预览

function viewPic(id, imgId) {
var reads = new FileReader();
f = document.getElementById(id).files[0];
if (f) {
reads.readAsDataURL(f);
reads.onload = function (e) {
document.getElementById(imgId).src = this.result;
$("#" + imgId).css("display", "block");
};
}
}
posted on 2019-09-23 19:06  卖小女孩的小男孩  阅读(97)  评论(0)    收藏  举报