日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

html5 图片上传 预览

發布時間:2023/12/2 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html5 图片上传 预览 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

<html>
<body>
<fieldset>
<legend>測試</legend>
<div class="form-group">
<div class="img-preview rl">
<form id="index_form1" name="index_form1" role="form" method="post" enctype="multipart/form-data" style="float: left;">

<div class="mui-col-xs-4 img-upload mui-text-center iconfont icon-shangchuantupian rl mui-pull-left" id="picone" style="background-image: url(imgs/andd.png);background-size:cover ;">
<span style="font-size: 15px; padding-left: 20px; position: absolute; float: left; margin-top: 104px;">測試</span>
<input type="file" class="wid-100 ab file" id="uploadpic1" name="uploadpic1" ?capture="camera" ??accept="image/*"??οnchange='doChange(this)'; />

<div class="mui-clearfix"></div>
</div>

</form>

</div>
</div>
</fieldset>

<img id="img1" src="a.jpg" style="width:200px;height:200px"/>
</body>
</html>

?

<script>if (typeof FileReader == 'undefined') {alert("抱歉,你的瀏覽器不支持FileReader");}function doChange(obj) {html5ImgLocalReader('uploadpic1', 'img1'); }function html5ImgLocalReader(fileId, imgId) {var file1 = document.getElementById(fileId);var file = file1.files[0]; var reader = new FileReader();reader.readAsDataURL(file);reader.onload = function (e) {document.getElementById(imgId).src=this.result;//document.getElementById(imgId).style.backgroundImage = "url(" this.result ")";} } </script>

  

From:http://www.cnblogs.com/xuejianxiyang/p/6845162.html

?

總結

以上是生活随笔為你收集整理的html5 图片上传 预览的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。