Here's what you'll need to run JavaScript code

Before you run Javascript code, there are a few things you'll need. Check out the requirements.

By Emily A. Vander Veer

If you have a text editor and a 2.0 or later version of Netscape Navigator, or a 3.0 or later version of Microsoft Internet Explorer, you have all you need to view and create JavaScript-enabled Web pages. For example, you should be using at least a 3.0 version of Navigator or IE.

JavaScript Compatibility Chart
JavaScript 1.0 — Netscape 2.0
JavaScript 1.1 — Netscape 3.x, MSIE 4.x
JavaScript 1.2 — Netscape Communicator 4.0 to 4.04
JavaScript 1.3 — Netscape Communicator 4.06 or later
Microsoft JScript ~ JavaScript 1.1

To add JavaScript to an HTML page, you need to surround it in special tags. When Navigator or IE sees these tags, it knows to treat the text that follows as JavaScript—unless the user has JavaScript support turned off, in which case the browser ignores the code.

Unfortunately, Navigator and IE sometimes treat the same JavaScript code in slightly different ways (partly because IE uses JScript, a proprietary implementation of JavaScript). So test your code in both browsers to make sure it works properly.

Steal our code

If you want to save yourself some time, you can copy and paste our examples into your own pages. Simply go to the example you want to use and click the "Click here" link. You can then select and copy all the code and drop it into your page. Once it's there, you can tweak it to change everything from text to logic.

Emily A. Vander Veer is the author of numerous Internet-related magazine articles and books, including JavaScript for Dummies, JavaScript for Dummies Quick Reference, and JavaBeans for Dummies, all published by IDG Books.

Editor's Picks

Free Newsletters, In your Inbox