效果如图 上代码 <!--html结构部分--> <input type="file"/> <img src="" /> <!--js部分--> var inp = document.querySelector('input'); inp.onchange =