0
Hey! I am new and I don’t know where is my error? Normally when I click on “Jump” button it’s count but not me can you help me?
window.onload = function() { let btn = document.getElementById(" jump"); let count = 0; btn.onclick = function() { count +=1; } } window.onload = function(){ var canvas = document. getElementById("canvas"); var context = canvas. getContext ("2d"); var x = 300; var y = 350; context.arc(x, y, 50, 0, 2 * Math.PI); context.fillStyle= "red"; context.fill(); }
13 odpowiedzi
+ 4
You don't appear to have your count displaying anywhere.
+ 7
You only need 1x window.onload
You might also need to remove all the blank space in " jump"
+ 3
Can you attach your code from the code playground?
+ 2
Something like this
window.onload = function() {
let btn = document.getElementById("jump");
let count = 0;
btn.onclick = function() {
count +=1;
}
var canvas =
document. getElementById("canvas");
var context = canvas. getContext ("2d");
var x = 300;
var y = 350;
context.arc(x, y, 50, 0, 2 * Math.PI);
context.fillStyle= "red";
context.fill();
}
+ 1
So do i erease the second one and just start the paragraph with the var?
+ 1
Do you know how to access the codeplayground? If so please save your code there, and share your link via the (+) symbol located right.
0
Yeah but its wrote: You should see the number of clicks increment in a dialog every time the Jump button is clicked.
0
Can you help me to do it please i dont know how to do it
0
Because i dont know how
0
What you mean
0
The java script?
0
Alexandre Synnott In the menu at the bottom select the "Create" section, the the "Code" tab, create a code there (it's called "code bit" here at SoloLearn), choose the "Web" code tab, and put your code there. Then save it as public code and share the link to it here.