亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    js簡單上傳圖片預(yù)覽功能的實(shí)例詳解

    js簡單上傳圖片預(yù)覽功能的實(shí)例詳解

    js簡單上傳圖片預(yù)覽功能-簡單粗暴

    js簡單上傳圖片預(yù)覽功能

    <!DOCTYPE html> <html> <head> <title>js簡單上傳圖片預(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>請選擇圖片文件:JPG/GIF</h3> <form name="form0" id="form0" >     <input type="file" name="file0" id="file0" multiple="multiple" />     <br>     <img src="" id="img0" width="150" height="150" style="display:none;"> </form> </body> </html>   <script type="text/javascript"> $("#file0").change(function(){     var objUrl = getObjectURL(this.files[0]) ;     console.log("objUrl = "+objUrl) ;     if (objUrl) {         $("#img0").attr("src", objUrl) ;         $("#img0").show();     } }) ; //建立一個可存取到該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>

    推薦教程:《JS基礎(chǔ)教程》

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號