In the pasture of this world, I endlessly push aside the tall grasses in search of the bull.
Following unnamed rivers, lost upon the interpenetrating paths of distant mountains,
My strength failing and my vitality exhausted, I cannot find the bull.
I only hear the locusts chirring through the forest at night.

Where is the JavaScript?

A web page is little more than a poster with a few 'active' processes: hypertext links, and forms to send information elsewhere. JavaScript can turn the static page into a dynamic interface with its own computing power. Where is it? You're looking at it. JavaScript created this pop-up, scrollable window. Passing your cursor over the key above, you'll see a JavaScript generated message in the status bar. If you 'click' the key, the source code for this page will appear in yet another window - again compliments of JavaScript. In following the Zen practice of being in the moment and really seeing what's here, the tutorial will often focus on the code of page itself - thus the ubiquitous key icon.

Where is the JavaScript code?

All html pages share the basic structure shown on the left. The html tags enclose two container tag pairs - the head and the body. The head tags contain the title tags demarcating the displayed window title. The body tags contain the code that defines the displayed page. The three elements of JavaScript - variables, functions, and event handlers - are woven into the html code of a web page. Variables and functions are contained within the new script html tags. Event Handlers are part of any html tags in the body of the page that initiate a JavaScript function.

Now look at the source code for this page by clicking the key icon. The script tags go in the head section just after the title. In this example, there are four functions - newBrowser(), viewSource(), viewOxherder(), and viewLinks(). For the moment, don't worry about the functions themselves. Notice that everything between the script tags is enclosed in html 'comment' tags. This is so it will be invisible to non-JavaScript enabled browsers. // is actually the JavaScript 'comment' marker to render the //---[JAVASCRIPT]--- inert. [JavaScript uses the C++ conventions for comments - either a line beginning with // ... or multiple lines enclosed with /* ... */ ]. Now look in the source code at the lines immediately below the html comment, Event Handlers. onClick, onMouseOver, and onMouseOut are JavaScript event handlers that initiate the JavaScript actions.

If you're new to JavaScript, you've just learned more than you think:

  • JavaScript is a powerful adjunct to the hypertext markup language. [JavaScript support is included in the Netscape Navigator 2.0, the Microsoft Internet Explorer 3.0, and all later versions from both companies].
  • The JavaScript code [variables, functions] is always placed within script tags in the head part of the page - exactly as shown in the source code of this page.
  • It is always a good idea to 'hide' the JavaScript from non-JavaScript enabled browsers - exactly as shown in the source code of this page.
  • The JavaScript functions are initiated by event handlers that are additional elements of familiar html tags - links, form elements, loading, etc..
  • NOTE: The JavaScript language is CASE SENSITIVE. function is not the same as Function.
The form and function of variables, functions, and event handlers will be the subject of the next section of the tutorial.

Where is the JavaScript niche?

The Internet's been around a while - since the Sputnik days of the 'Cold War'. It's been a part a national defense plan, a factor in the breach of the 'Iron Curtain', and the platform for some of the more exciting advances in computer technology e.g. UNIX, TCP/IP. But it didn't really get our attention until Tim Berners-Lee at CERN conceived the World Wide Web - combining mobility, visual appeal, and search capabilities.

It's interesting that these web pages have captured our imagination in such a dramatic way - considering their simplicity. Their only actions are hypertext links to other pages and forms that pass information to servers. The software that we use to read these pages has evolved quickly - from the primitive Mosaic to the advanced Netscape and Microsoft offerings in a few short years. It was inevitable that there would soon be movement to extend the functional capacity of the web page.

Java
The most ambitious take on the problem is Java from Sun Microsystems. Java is a complete multi-platform, interpreted language similar to C++ [that has a serious learning curve]. It continues to be the 'wave of the future', but for now, it's for the initiated.
VB Script and ActiveX
Microsoft's Visual Basic Scripting and ActiveX controls promise to bring the full power of the Windows GUI to the Internet. This is an exciting and robust language for complex web programming - now supported by the Internet Explorer.
JavaScript
JavaScript was introduced in Netscape 2.0 and is now available in both Netscape 3.0 & 4.0 and the Microsoft Internet Explorer [as JScript]. JavaScript is an Object Oriented language that takes the browser and its elements as objects, giving the author control of the interface and a full set of programming tools - while remaining invisible to the user except by way of increased functionality. It is an elegantly simple approach to web programming. While it is the most modest offering, it has plenty of power; it's stable and widely supported; and it's easy to learn. At the least, it's a good one to start with - thus our tutorial.