KEY: 物件、事件、DataURL

FileReader() : line 4, 物件建構元 F,R 大寫,這是物件建構元(constructor)

<head>
<script>
function loadImg(e){
var f=new FileReader();
f.onload=function(){
  img.src=f.result;
}
f.readAsDataURL(e.files[0]);
}
</script>

</head>
<body>
<input type="file" onchange="loadImg(this)">
<img id="img">
</body>language


</body>
</html>