HTML5 图片上传预览

HTML5 图片上传预览
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8" />
<meta name="author" content="EdieLei" />
<title>HTML5 图片上传预览</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
    $(function () {
        $(#img).change(function () {
            var file = this.files[0];    //选择上传的文件
            var r = new window.FileReader();
            r.readAsDataURL(file);    //Base64
            $(r).load(function () {
                $(div).html(<img src=" + this.result + "  />);
            });
        });
    });
</script>
</head>
<body>
<h3>HTML5 图片上传预览</h3>
<input id="img" type="file" accept="image/*" /><br />
<div></div>
</body>
</html>
HTML5 图片上传预览

 

HTML5 图片上传预览,布布扣,bubuko.com

HTML5 图片上传预览

上一篇:解决mysql for docker容器报错:Authentication plugin 'caching_sha2_password' cannot be loaded


下一篇:Docker (3) 使用docker 安装mysql、tomcat、ngnix、redis