+ 1
How to connect JavaScript with my HTML code
Hello, I'm new here and a newbie so please help :) Thanks :* I'm trying to code a little snake game in web but when I want to getElementById in order to use my canvas, JavaScript keep saying me that, It can't use getContext on a null type object which mean getElementById returns me an empty array, I think. So, is there a solution ? Do I have to "links" my JavaScript code with my HTML and if so, how ? I don't ask before because I was thinking that Sololearn auto-linked me. Thanks for help ♥️
3 odpowiedzi
+ 1
Try using the script tag
0
Works if i use the script tag in my HMTL page but I would like to know why I can't use my Java page :/ Thanks
0
Please need some help !
In the script tag, my code works perfectly fine, but it doesn't in my JS window...
It keeps saying me : Cannot read property "getContent" of null...
Help please