$('#myfile').change(function() {var file = this.files[0];var reader = new FileReader();reader.onload = function() {var url = reader.result;setImageURL(url);};reader.readAsDataURL(file);});var image = $("#previewImg")[0];function setImageURL(url) {image.src = url;} 这段代码替换掉老师那个change()方法可以让图片展示出来
2016-09-17