These examples are presented without explanation. For a more complete treatment of the JavaScript code you can refer to "Start Programming with JavaScript" by Bill Tait, which is available in Kindle and paperback format from Amazon.
JavaScript is now the only viable way to add interactive programs to web pages. As a programming language it is easy to learn, completely free and fully compatible with mobile browsers so your apps can be deployed to a wide market. This is in contrast to Java and Flash which will not run in mobile devices.
You can start learning JavaScript here. This is a tutorial for complete beginners to JavaScript and to programming in general.
And here you can find JavaScript examples
JavaScript clock that shows current system time, using the HTML canvas
Calculator with full four functions, using an HTML form
Bouncing balls with HTML and JavaScript.
Draughts or checkers depending on whether you are from the UK or the US. Click to lift a piece and click to place it
JavaScript is part of the HTML5 technology which includes the latest version of html, style sheets and JavaScript. JavaScript graphics depends on the canvas element provided by HTML5.
You can start learning about HTML5 here and Style Sheets here. Again, these are tutorials for complete beginners to web page design.