需求:点击选择图片(可选多张),确定后将选择的图片显示在页面上,点击提交将图片提交给后台。
效果图:

源码demo:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>showImages</title>
<style type="text/css">
.float{
float:left;
width : 200px;
height: 200px;
overflow: hidden;
border: 1px solid #CCCCCC;
border-radius: 10px;
padding: 5px;
margin: 5px;
}
img{
position: relative;
}
.result{
width: 200px;
height: 200px;
text-align: center;
box-sizing: border-box;
}
#file_input{
display: none;
}
.delete{
width: 200px;
height:200px;
position: absolute;
text-align: center;
line-height: 200px;
z-index: 10;
font-size: 30px;
background-color: rgba(255,255,255,0.8);
color: #777;
opacity: 0;
transition-duration: 0.7s;
-webkit-transition-duration: 0.7s;
}
.delete:hover{
cursor: pointer;
opacity: 1;
}
</style>
<script src="http://libs.baidu.com/jquery/2.0.

本文介绍如何使用HTML5的FileReader API实现用户在网页上选择多张图片后实时预览,并在点击提交后将图片数据发送到后台的功能。详细展示了相关代码示例。
最低0.47元/天 解锁文章
6万+

被折叠的 条评论
为什么被折叠?



