Yes, all the examples you'll find in this Online Companion and in the book have been tested and work.
The more complicated answer is, which browser are you using? JavaScript is a programming language in development. When you consider the different browser "models" (Netscape Navigator and Internet Explorer), the different operating systems, and the different software releases, there are literally scores of different versions of JavaScript browsers. Each version handles JavaScript a little differently, each has its own bugs, and each has its own improvements over prior releases. Even browsers with the same version number but designed for different operating systems will act differently. We know that some of our scripts do not work with some browsers thanks to a number of bugs in those browsers. Most scripts will work with Netscape Navigator 2 and Internet Explorer 3. However, some will not, and we recommend that you use Netscape Navigator 4. (Note that some early the Netscape Navigator 4 Preview Releases have significant bugs and a number of JavaScript features missing, features that were present in Navigtor 3; we recommend that you do not use a version of Navigator earlier than the most recent version available.)
Another thing to check...is JavaScript enabled in your browser? The Netscape Navigator browsers allow you to turn JavaScript on and off. In Navigator 4 select Edit|Preferences, then click the Advanced category to find the check boxes used to turn JavaScript on and off. (In Navigator 3 use Options|Network Preferences; in Navigator 2 use Options|Security Preferences and click on the Language tab.)
Okay, having said all that, let's begin.