慕标琳琳
var myfile = document.getElementById('file'); var List = document.getElementsByClassName('list')[0];myfile.onchange = function(){ var files = this.files; for(var i = 0;i<files.length;i++){ var oFReader = new FileReader(); oFReader.readAsDataURL(files[i]); oFReader.onload = function (oFREvent) { console.log(oFReader); var oLi = '<li><img src="'+oFREvent.target.result+'"><span class="close" onclick="closeli(this)" >×</span></li>'; List.innerHTML+=oLi; }; } }oFREvent.target.result为base64地址,直接赋给src就行了