html5 插入图 用canvas 两个文件,一个html,一个js文件。图片和文件在同一文档。
html:<scripttype="text/javascript"src="frogger.js"></script><canvasid="myCanvas"width...
html:<script type="text/javascript" src="frogger.js"></script>
<canvas id="myCanvas"width="650" height="450"></canvas>
js:var image =document.getElementById("myCanvas");
var imgx=image.getContext("2d");
var img = new Image();
img.src='zuihou.jpg';
img.onload = function()
{imgx.drawImage(img, 650, 450);} 展开
<canvas id="myCanvas"width="650" height="450"></canvas>
js:var image =document.getElementById("myCanvas");
var imgx=image.getContext("2d");
var img = new Image();
img.src='zuihou.jpg';
img.onload = function()
{imgx.drawImage(img, 650, 450);} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询