Javascript: How do I perform a action with the click of a button?
What is the proper syntax for clicking a button and having Javascript run
whatever statement you have? I did a google search but there is either
multiple ways or people aren't explaining the parameters or functions very
well.
Here is my code. All I want to do is when I click "attack" on my "button",
the monster will lose 10 hp.
document.getElementById("attack").click(); = dragon.hp = dragon.hp - 10;
No comments:
Post a Comment