|
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. |
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:
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.
|
|
|
|