Changing variable by html button

前端 未结 8 1298
野的像风
野的像风 2021-01-18 00:23

I\'m learning javascript and I decided to create simple Rock, Paper, Scissors game. I want to make it controllable by buttons. So I made this in html:



        
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-18 01:27

    The other answers are fixing some issues. There is also a problem with the way you're calling the functions as you're passing rock as a variable, you need to use a string:

    
    

    Unless you're declaring the variables somewhere but it's not shown in your code.

提交回复
热议问题