<html>
<body>
<div class="checkbox_div">
<label>
<img style="cursor:default" class="image_div" onclick="" id="img_0">
<input th:id="icimg_10_1" name="files" type="file" accept="image/*" value=""
capture="camera" onchange="xmTanUploadImg(this)" data-index="0" style="display: none">
</label>
</div>
</body>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script>
function xmTanUploadImg(obj) {
var key = parseInt(obj.dataset.index);
var file = obj.files[0];
var reader = new FileReader();
reader.onload = function (e) {
hasChanged = true;
$('.img_view_' + key).attr('src', e.target.result);
}
reader.readAsDataURL(file)
}
</script>
</html>
最简单的图片回显
最新推荐文章于 2022-07-25 19:29:01 发布