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(); }

12th Apr 2023, 12:12 PM
Alexandre Synnott
12 Respostas
+ 4
You don't appear to have your count displaying anywhere.
12th Apr 2023, 1:30 PM
Ausgrindtube
Ausgrindtube - avatar
+ 7
You only need 1x window.onload You might also need to remove all the blank space in " jump"
12th Apr 2023, 12:33 PM
Ausgrindtube
Ausgrindtube - avatar
+ 3
Can you attach your code from the code playground?
12th Apr 2023, 6:43 PM
Ausgrindtube
Ausgrindtube - avatar
+ 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(); }
12th Apr 2023, 1:29 PM
Ausgrindtube
Ausgrindtube - avatar
+ 1
So do i erease the second one and just start the paragraph with the var?
12th Apr 2023, 12:35 PM
Alexandre Synnott
+ 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.
13th Apr 2023, 1:27 AM
Chris Coder
Chris Coder - avatar
0
Yeah but its wrote: You should see the number of clicks increment in a dialog every time the Jump button is clicked.
12th Apr 2023, 2:21 PM
Alexandre Synnott
0
Can you help me to do it please i dont know how to do it
12th Apr 2023, 2:22 PM
Alexandre Synnott
0
Because i dont know how
12th Apr 2023, 5:01 PM
Alexandre Synnott
0
What you mean
12th Apr 2023, 6:49 PM
Alexandre Synnott
0
The java script?
12th Apr 2023, 6:58 PM
Alexandre Synnott
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.
12th Apr 2023, 9:22 PM
ЕĐČĐłĐ”ĐœĐžĐč
ЕĐČĐłĐ”ĐœĐžĐč - avatar