图片预览
程序员文章站
2022-03-04 19:00:04
...
<input type="file" />
<script type="text/javascript">
var f = document.getElementsByTagName('input');
f[0].onchange = function(){
var file = this.files[0];
var url=window.URL.createObjectURL(file)
var img=new Image();
img.src = url;
document.body.appendChild(img);
}
</script>