Its syntax, however, looks similar enough to learn it more easily if you know Java.
Script can be contained in the 'head' tag, ...
in this case just three variables, ...
What's remarkable is, that you don't specify data types ( like 'int' ), as is required in Java. Variable names can be as long as you like and consist of letters, digits and underscores. They must start with a letter, underscore or dollar sign.
If you stick to the European standard, ECMAScript, CSS1 and the W3's DOM Level1 model, you will have a script that can be expected to run on most browsers without too many glitches.
Browsers have their own additions, but you seldom really need those.
These comment tags should be there for the sake of browsers that don't support scripting.
Add 1 to cnt, two times. There's a difference between the operators used, but in this context the effect is the same.