function getObjectURL(file) {
var url = null ;
if (window.createObjectURL!=undefined) { // basic
url = window.createObjectURL(file) ;
} else if (window.URL!=undefined) { // mozilla(firefox)
url = window.URL.createObjectURL(file) ;
} else if (window.webkitURL!=undefined) { // webkit or chrome
url = window.webkitURL.createObjectURL(file) ;
}
return url ;
}
document.getElementById('Jbtn').onchange = function() {
var fileList = this.files;
for (var i = 0; i < fileList.length; i++) {
var strsrc=getObjectURL(fileList[i]);
$("#show_img").append("<img src='"+strsrc+"'>");
}
}
多图上传预览代码
最新推荐文章于 2022-05-15 00:57:21 发布