0

i need help with image.i put the image in the canvas and it's not working.

setInterval(function(){
    game();
}, 1000/30);
#start{
background-color:#33ff00;
}
<html>
<head>
<title>beta</title>
<link href="chip.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<canvas height="938" width="1890" id="start"><img src="chio.jpg"/></canvas>
<script src="beta.js"</script>
</body>
</html> 

i'm lost at this point.

spgice S
  • 29
  • 3
  • 2
    since canvas can be seen as a drawing table in which you dont simply put elements like you would in a basic DIV you have to use a different approach http://www.w3schools.com/html/html5_canvas.asp find some examples here, otherwise look for canvas tutorials, there are plenty – noa-dev Sep 06 '15 at 17:47
  • "Given that the canvas element has a transparent content model, it may contain *fallback* elements which are displayed in the event that the `canvas` element is unsupported. They will **not** be displayed if the canvas *is* supported." -> http://stackoverflow.com/a/4797877/1913729 – blex Sep 06 '15 at 17:48

1 Answers1

0

The canvas element can't have an img child element. If you want to embed a picture file within a canvas element, you have to draw the picture onto the canvas with drawImage().

TDHofstetter
  • 268
  • 2
  • 7