Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (wwb00):

HTML Canvas error

OpenStudy (wwb00):

I had to reduce the number of files for my submission online, and I removed one of the codes, and pasted it into the html. This is giving an peculiar error in the displaying of the canvas.

OpenStudy (wwb00):

It wont allow me to post the html. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Canvas</title> <style>#mycanvas {border: 1px solid #000;} body{ font-family:"Geneva", verdana, sans-serif; margin: auto 10px; width: auto; height: 800px; background-color: #74AFAD; } article.textbox { border: 10px solid #558C89; background: #ECECEA; color: #393E41; height: 600px; width: 1000px; float: top; margin: atuo; } </style> </head> <body> <article class="textbox"> <a href = "night.html"> <canvas id="mycanvas" width = 1000 height=600> <p>Your browser does not support the canvas app. Stop using Internet Explorer</p> </canvas> </a> </article> <script src="functions.js"></script> <script> drawBackground("#3e9aff");//background drawCircle(150,150,50,"#ffd633");//sun drawRays(150,150,20,20,60,0.5,30,"#ffd633");//sun rays drawCircRow(325,125,50,6,true,"white","white");//clouds drawCircRow(300,150,50,7,true,"white","white");//clouds drawCircRow(275,100,50,7,true,"white","white");//clouds drawHouse(600,300,360,250,2);//house drawCircRow(900,50,20,6,false,"gray","gray");//smoke drawRect(880,200,40,90,"#B87333");//chimney drawTriangle(560,300,780,200,1000,300,"#994c00")//roof drawRect(665,330,80,80,"#B87333");//window box drawWindow(704,370,4,"#994c00");//window panes drawRect(815,330,80,80,"#B87333");//window box drawWindow(856,370,4,"#994c00");//window panes drawRect(645,445,66,160,"#994c00");//door frame drawRect(650,450,56,150,"#B87333");//door drawCircle(700,500,2,"#e6b800");//doorknob drawTriangle(300,550,350,300,400,550,"#994c00");//windmill base drawRays(350,300,-20,-20,150,2,20,"#B87333");//windmill fins drawCircle(350,300,20,"#994c00");//centre of windmill drawGround("green");//ground drawGrass(0,535,1000,65,4000,"#006600","#00b300");//draws gras </script> </body> </html>

OpenStudy (wwb00):

@SolomonZelman

OpenStudy (wwb00):

please help!

OpenStudy (beautifulmystery.):

use adobe Dreamweaver

jaynator495 (jaynator495):

Yea sorry, due to me any file containing <script> is blocked from being posted... ( I did something stupid... Several things stupid xD ) @TheSmartOne

OpenStudy (lyrae):

There's a call to a undefined function "getRandomColour()" in drawRays() on line 99. Javascript will evaluate to this point by hence you get the sun and BG but nothing else. I commented the line out and now get the grass, cabin, smoke, clouds, etc. I really like how the clouds and smoke changes :) <canvas id="mycanvas" width = 1000 height=600> ^ ^ Although quotes in HTML5 is not mandatory for attribute arguments I still recommend to always use them because it's a good habit if you are going to work on some older stuff and better support for editors and portability.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!