我已经看过所有帖子,解释了如何将HTML5画布截图保存为图像并在新标签中打开该图像。但是,我希望获取该屏幕截图,并在截屏后将图像显示在SAME WEBPAGE上已分配的div中。有任何想法吗?谢谢!
答案 0 :(得分:0)
<canvas id="mycanvas"></canvas>
<div id="under_canvas"></div>
<script>
var canvas = document.getElementById('mycanvas');
var img = canvas.toDataURL("image/png");
//dataURL can directly be inserted into src of image
document.getElementById('under_canvas').innerHTML = '<img src="'+img+'"/>';
</script>