圖片在線預覽之ObjectURL

function previewImg(self,imgId ) {
            var url=createObjectUrl(self.files[0]);
            document.getElementById(imgId).src=url;
    }

    function createObjectUrl(Blob) {
       if(window.URL){
           return window.URL.createObjectURL(Blob);
       }else if(window.webkitURL){
            return window.webkitURL.createObjectURL(Blob)
       }
    }
相關文章
相關標籤/搜索