zoukankan      html  css  js  c++  java
  • H5调用ios,安卓手机摄像头和相册

    /*
     * 调用ios,安卓手机摄像头和相册
     */
    HTML:
    <a href="javascript:;" class="file">
        自定义的文本框
        <input id="car_file" type="file" accept="image/*" multiple />
    </a>
    
    CSS:
    .file {
        position: relative;
        display: inline-block;
        background: #ffffff;/*--#D0EEFF;*/
        border: 1px solid #999;
        border-radius: 0px;
        /*padding: 4px 12px;*/
        overflow: hidden;
        /*color: #1E88C7;*/
        text-decoration: none;
        text-indent: 0;
        /*line-height: 20px;*/
    }
    .file input {
        position: absolute;
        /*font-size: 100px;*/
        right: 0;
        top: 0;
        opacity: 0;
    }
    
    //当文本框改变时
    $("#car_file").change(function(){
       readURL(this);
    });    
    
    function readURL(input) {
        if(input.files.length>0){
            for(var a=0;a<input.files.length;a++){
                var reader = new FileReader();
                reader.readAsDataURL(input.files[a]);                
                var i=images.length;
                reader.onload = function (e) {
                    i++;
                    $("#imageDiv").append("<img attr='"+i+"' src='"+e.target.result+"' style='100%;height:100%;margin-top:10px;'/>");
                }
            }
        }
    }
  • 相关阅读:
    每日站立会议08
    MAVEN常用命令
    android开发环境搭建
    阻止默认事件和阻止事件冒泡
    C#ActiveX安装项目
    System&Software
    poj 1386 Play on Words 有向欧拉回路
    poj 1033
    120.Triangle
    pandas中 transform 函数和 apply 函数的区别
  • 原文地址:https://www.cnblogs.com/AnswerTheQuestion/p/8317906.html
Copyright © 2011-2022 走看看