JavaScript is a programming language which can be integrated with HTML, so that web authors can put programming instructions between the lines of text on their web pages. Technical authors with some knowledge of programming can have the best of both worlds and create pages which are half-document and half-program.

Only a few years ago, programming and technical writing used to be entirely different activities, but the increasing sophistication of documentation tools means that the technical author has to be, to some extent, a programmer. The transition from technical author to programmer is roughly something like this.

  1. Writing documents with a word processor.
  2. Using the programming features of a word processor to create macros and templates.
  3. Running a help compiler to create Windows on-line help.
  4. Writing web pages. You can make simple pages with an HTML editor, but it helps to know the syntax of the HTML tags and write your own lines of code using a text editor. Most HTML editors give you a text view so that you can edit the code directly.
  5. Running a help compiler to create HTML help.
  6. Adding JavaScript code to HTML documents to make them behave like programs with the ability to do calculations.
  7. Adding Java applets to HTML documents. An applet is a small program which has its own user interface and appears as a window between the tags of an HTML document. Multiple applets on the same page can interact with each other.
  8. Once you've gone this far you might as well go all the way and create full-blown Java applications which run in a Java interpreter and do not need to use a browser. On the other hand, you might decide not to bother. It might have been better to become a programmer in the first place.

In this transition, steps 1 to 5 are mostly documentation, while steps 7 and 8 are programming. Only JavaScript is the half-way house between the two, as the program and document are intertwined with each other.

For example, suppose you want to write My name is Mike. In HTML you would enclose the text between paragraph tags like this:

<P>My name is Mike.</P>

In JavaScript you would do it like this:

myName = "Mike";
document.write("<P>My name is " + myName + ".</P>");

The advantage of using JavaScript is that the variable myName can be given any value, and might be derived from a list of names.

The programming syntax is similar to the "C" language, but without the complexities of Visual C++. Anyone who is familiar with "C" should soon be able to pick up JavaScript.

Java, on the other hand, is a more tightly structured language similar to Visual C++, but without the Microsoft Foundation Classes. Instead there are some ready-made controls, but Java still takes longer to learn than JavaScript.

Most modern web browsers are able to run JavaScript code and display Java applets by default, but on some browsers you might have to go into a preferences screen and turn them on.

There are two types of JavaScript programming, client-sided and server-sided. Client-sided programming can be done by anyone with an Internet account that enables you to upload pages to the web. Server-sided programming requires access to a server, or a managed account from your Internet service provider (usually at extra cost). Client and server-sided JavaScript both use the same core language elements, but server-sided programming requires a higher level of programming knowledge, including access to CGI scripts and databases.

In recent years, JavaScript has become increasingly popular on the Internet. In particular, ready-made code fragments are available for you to manipulate to suit your purposes. The left-hand navigation bar of this website uses a fragment with drop-down menus that were entirely text-based, but the headings have been been replaced with buttons. The original code fragment with the text headings is available free from:


  1. If you don't see the navigation bar, display the home page.
  2. For latest versions of the text-based fragment (which you can modify), see Fridsten Web Development.

Please contact me if you require web pages or on-line help systems that include JavaScript.

Copyright 2000 Updated December 2004

Mike Gascoigne, Write_on
Send a mail message