<img src="" width="100px" height="100px"/> <input type="file" onchange="showPreview(this)"/> //图片预览的 function showPreview(source){ var file = source.files[0]; if(window.FileReader) { var fr = new FileReader(); fr.onloadend = function(e) { $(source).parent().children("img").attr("src",e.target.result); }; fr.readAsDataURL(file); } }