<html>
<input id="f" type="file" onchange="chooseImg(this)" style="display:none">
<img id="img" width="40" height="40" onclick="f.click()">
<js>
function chooseImg(file){
? ? var file=file.files[0];
? ? var reader=new FileReader();
? ? reader.readAsDataURL(file);
? ? reader.onload=function(){
? ? ? ? ? ?var img=document.getElementById('img');
? ? ? ? ? ?img.src=this.result
? ? };
}