- 1
Hey i need your help and would like to know why this code wont run..There is an current error in line 13/14..
<!DOCTYPE html> <html> <head> <title> Canvas </title> <script> var img = new Image(); img.src = "Marcjd.jpg"; function draw(){ var ctx = document.getElementById('myCanvas') .getContext('2d'); ctx.drawImage(img, 20, 20); } window.onload=draw; </script> </head> <body> <script> <canvas id="myCanvas" width="300" height="500"> </canvas> </script> </body> </html>
2 ответов
+ 1
does "document.getElementById('myCanvas')
.getContext('2d');"
need to be writren in the same line maybe?
0
#body{
background-color: #666;
margin:10px;
}
#myCanvas{
background-color:#FFF;
border: 1px solid black;
}
Thats the css code i use but i dont think its importan for this question