html5选择多张图片在页面内预览

本文介绍如何使用HTML5的FileReader API实现用户在网页上选择多张图片后实时预览,并在点击提交后将图片数据发送到后台的功能。详细展示了相关代码示例。
摘要由CSDN通过智能技术生成

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

效果图:
在这里插入图片描述
源码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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值