<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
#MyCanvas {
background: whitesmoke;
}
</style>
</head>
<body>
<canvas id="MyCanvas" width="500" height="350"></canvas>
</body>
<script type="text/javascript">
var c = document.getElementById("myCanvas");
var cxt = document.getContext("2d");
var img = new Image();
img.src = "img/003.jpg";
img.onload = function() {
ctx.drawImage(img,50,50)
}
</script>
</html>
var c = document.getElementById("MyCanvas");
var ctx = c.getContext("2d");
var img = new Image();
img.src = "img/64.jpg";
img.onload = function() {
ctx.drawImage(img, 50, 50)
}
你这错别字真多
出不来
@LearningOfBoy: 把我的拷过去替换掉你的js就行了,除了图片路径你别改其他东西就能出来
@地火水: 好的
谢谢,谢谢
问下html转化canvas,html内的canvas转化不出来是怎么回事