javascript - HTML5 canvas scripting ignored -


i missing painfully obvious. reason why can find canvas using "inspect element" because declared when id attributed. javascript blatantly ignored. i've tried various commands on canvas context; nothing happens. appreciated. here example:

<!doctype html> <head> </head> <body> <div id="container">         <header>     <canvas id="title_canvas" width: "1200px"; height: "100px"></canvas>     <script>         var title_c = document.getelementbyid("title_canvas");         var title_ctx = document.getcontext("2d");         title_ctx.fillrect(0,0,100,90);     </script>        </header>    </div> </body> </html> 

you need call getcontext on canvas, not document.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -