我有这个在画布中绘制图像的简单代码,但它只适用于 Firefox
这是代码:
<!DOCTYPE html>
<html>
<head>
<title>CANVAS</title>
</head>
<body>
<canvas id="smallImage" width="600" height="600"></canvas>
<script>
var imgid = document.getElementById('smallImage');
var ctx = imgid.getContext('2d');
var img = new Image();
var immmagine = "flowers.jpg";
img.src = immmagine;
ctx.drawImage(img,0,0);
</script>
</body>
</html>