中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

HTML5 上傳前預(yù)覽

2018-07-20    來(lái)源:open-open

容器云強(qiáng)勢(shì)上線!快速搭建集群,上萬(wàn)Linux鏡像隨意使用
    <!DOCTYPE html>  
    <html>  
    <head>  
    <title>HTML5上傳圖片預(yù)覽</title>  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
    <script src="http://www.codefans.net/ajaxjs/jquery-1.6.2.min.js"></script>  
    </head>  
    <body>  
    <h3>請(qǐng)選擇圖片文件:JPG/GIF</h3>  
    <form name="form0" id="form0" >  
    <input type="file" name="file0" id="file0" multiple="multiple" /><br><img src="" id="img0" >  
    </form>  
    <script>    
    $("#file0").change(function(){  
        var objUrl = getObjectURL(this.files[0]) ;  
        console.log("objUrl = "+objUrl) ;  
        if (objUrl) {  
            $("#img0").attr("src", objUrl) ;  
        }  
    }) ;  
    //建立一個(gè)可存取到該file的url  
    function getObjectURL(file) {  
        var url = null ;   
        if (window.createObjectURL!=undefined) { // basic  
            url = window.createObjectURL(file) ;  
        } else if (window.URL!=undefined) { // mozilla(firefox)  
            url = window.URL.createObjectURL(file) ;  
        } else if (window.webkitURL!=undefined) { // webkit or chrome  
            url = window.webkitURL.createObjectURL(file) ;  
        }  
        return url ;  
    }  
    </script>  
    </body>  
    </html>  

標(biāo)簽:

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請(qǐng)聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請(qǐng)與原作者聯(lián)系。

上一篇:JSP實(shí)現(xiàn)的簡(jiǎn)單購(gòu)物車

下一篇:List 排序 Java工具類