单图上传显示1

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<input type="file" id='file'; onchange="c()">
<img src="" id='show'>
</body>
<script type="text/javascript"> function c () { var r= new FileReader(); f=document.getElementById('file').files[0]; r.readAsDataURL(f); r.onload=function (e) { document.getElementById('show').src=this.result; }; } </script> </html>

 

posted @ 2017-12-05 09:35  王玉岩  阅读(55)  评论(0编辑  收藏  举报