<html> <head> <title>测试</title> <script type="text/javascript"> window.onload = function () { if (window.attachEvent) { document.getElementById("file1").attachEvent('onpropertychange', function (o) { document.getElementById("imgID").src = 'file:///' + document.getElementById("file1").value; }); } else { document.getElementById("file1").onchange = function () { document.getElementById("imgID").src = window.URL.createObjectURL(document.getElementById("file1").files[0]); } } } </script> </head> <body> <div> <img id="imgID" src="C:fakepathpsb.jpg" /> </div> <div> 上传:<input type="file" id="file1" /> </div> </body> </html>