- 1

I Need Help In My HTML GAME

In my new game that I made https://code.sololearn.com/WgFNSSC1psch/?ref=app I want to make it so that when you click the orange rectangle it gives you a point but if you accidentally click anything but the orange rectangle then you score goes back to zero. I tried to make the body onclick="lose()" then make the function turn your score to zero but then it doesn’t change the score if I click the rectangle. I need answers please.a

1st Jan 2018, 6:38 PM
Someone Else
Someone Else - avatar
5 odpowiedzi
0
For ne it works normal
1st Jan 2018, 8:08 PM
Rokas Morkūnas
Rokas Morkūnas - avatar
0
me•
1st Jan 2018, 8:08 PM
Rokas Morkūnas
Rokas Morkūnas - avatar
0
hmm idk
1st Jan 2018, 8:10 PM
Rokas Morkūnas
Rokas Morkūnas - avatar
0
This code doesn't reference the body. In JS reference the document using document. getElementByTag ("body") Then set its onclick.
1st Jan 2018, 11:49 PM
josh mizzi
josh mizzi - avatar
- 1
Yes I know the rectangle works but I can’t find out how to make the body onclick make your score go to Zero
1st Jan 2018, 8:08 PM
Someone Else
Someone Else - avatar