来源:http://topic.csdn.net/u/20091110/16/e80ba2fc-59fa-4e2a-b4d7-8f068b4d5597.html
下面方法是直接解析图片,并用img.src显示
<script >
function getFullPath(obj){
if(obj){
//ie
if (window.navigator.userAgent.indexOf("MSIE")>=1){
obj.select();
return document.selection.createRange().text;
}
//firefox
else if(window.navigator.userAgent.indexOf("Firefox")>=1){
if(obj.files){
return obj.files.item(0).getAsDataURL();
}
return obj.value;
}
return obj.value;
}
}
</script>
<input type="file" onChange="img1.src=getFullPath(this)"><br>
<img name="img1" id="img1">