<div class="codetitle"> <span><a style="CURSOR: pointer" data="70968" class="copybut" id="copybut70968" onclick="doCopy('code70968')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code70968"> <br><img id="img1" src="" alt="javascript firefox不显示本地预览图片问题的解决方法_javascript技巧" > <br><script> <BR>function fileChange(obj) { <BR>var url = obj.value url = "file:///" + url.replace("\\",'/'); <BR>alert(url); <BR>document.getElementById("img1").src= url; <BR>} <BR></script> <br><input type="file" onchange="fileChange(this);"> <br> </div> <br>关键是:url = "file:///" + url.replace("\\",'/')