function draw(){ var loadImg=document.getElementById("image").getContext('2d'); var imgFile=document.getElementById("file"); var img=new Image(); img.onload= function () { loadImg.drawImage(img,0,0); } img.src=imgFile.innerHTML;} window.onload= function () { draw();}<div id="image"></div> <input type="file" id="file" name="file" onchange="draw()" accept="image/*">
添加回答
举报
0/150
提交
取消