I’m very new to javascript so please forgive me this if it’s actually a crazy simple thing to do, but I’ve been googling and going through all my reference sites with no luck. What I’m trying to do is display a variable’s value and change the value the variable either +1 or -1 when the user clicks the appropriate button – like this.
Can anyone help me? Thanks!
The following is an example you can work with. It’s a full HTML page, which you can open in a web-browser to see in action. Copy and paste it into a text-file, which you save as
example.html. Open it in notepad or something similar to edit it.This is just one simple example – there are many ways to do stuff like this. Google around, see examples, and play around with them, and it will make sense, bit by bit.
Though it is old, and not always perfect, the examples at W3C may still be a good place to start if you want to know more.
UPDATE: One little addition: If you want a fairly new and good book on Javascript, and want to learn it “correctly”, then JavaScript: The Good Parts is probably the book you want. It is not a big book (just under 100 pages if I remember correctly), but gives a nice overview of the language.