+ 3
What the error with c
I copied this code .. and it works fine on my browser but it give me errors .. and I don't who to fix it . https://code.sololearn.com/WmjlkoiXx1fN/?ref=app
5 Respuestas
+ 3
c is canvas. You need to get DOM element.
window.onload = function () {
var c = document.getElementById("c") ;
... Your other scripts...
}
+ 3
Gordon thx for your care
I did as you said but still have an error in line 7 in js code
+ 3
No thanks it works now Gordon
+ 2
Oh. You already have that part, in HTML body
In this case,
Put your codes in js tab under line 13 of your html.
+ 2
Welcome
Can you mark [SOLVED] in your question?
Also, I should explain a little bit
The code playground will put scripts in all three tabs into one html
The scripts in js tab will be put in end of head. And the script will run before the DOM exist. So getElement methods will return null.
There are two ways to solve it.
One way is putting the script at end of body in html tab
Another way is to assign the scripts as callback attaching to load listener of window.