+ 5

Why I am unable to get the context of canvas in this code?

I want to get the context but I am unable . Please help!! https://code.sololearn.com/W4BDnjv2nhob/?ref=app

4th Jun 2019, 5:34 PM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
5 Antworten
+ 1
You should add onload event to load HTML first. Look at the code. https://code.sololearn.com/W4gzTC91cUjL/?ref=app
4th Jun 2019, 5:56 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 6
TheWh¡teCat okay that means we need to use window onload function when we arw writing it in the js tab. Thanks for clearing all of my queries😊😊👍.
4th Jun 2019, 6:51 PM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 5
TheWh¡teCat is it necessary to define an onload function. I mean why the onload function is not defined here? https://www.sololearn.com/learn/HTML/2201/
4th Jun 2019, 6:13 PM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 1
If you do it in the HTML "script" tag it is loaded together with HTML. See the other example https://code.sololearn.com/WjQpw4BqyU6f/?ref=app
4th Jun 2019, 6:21 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
Prince PS , you are welcome. I'm happy to help 😉
4th Jun 2019, 6:52 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar