One of the most powerful features which a language can have is the ability
to write and execute code. Up until the advent of Javascript, the only
language which could do that was Hypertalk, the scripting language of Apple's
Hypercard. Hypercard long preceded Visual Basic as an object oriented language
with a drag and drop user interface. It can even act as a simple database with
its metaphore of a stack of filing cards. Alas, it was written for the old
black and white Macintosh and never really updated to a color program although
Apple has added some color via an XCMD. Its color is limited and klutsy,
however. Consequently, a really powerful program goes largely ignored and is
totally unknow to Windows users.
Hypercard can modify its own scripts and write scripts on the fly for
components which it can manufacture on the fly. It can also 'do' a field; e.g.,
if the field contains hypertalk, it can execute the code in the field. Although
Javascript does not yet have the depth of Hypercard, it is catching up fast and
has some unique features of its own. Of course, it supports as much color as
your graphics card and screen can handle and has the added benefit of being
available to all of the platforms for which Netscape makes a browser.
Although Javascript cannot alter its own script, or much of anything in its
own window, it is perfectly capable of producing a new window or writing
elements to the current page upon a rewrite of that page. It can
also easily write to documents in other frames. The Morphics Molecules Pages
contain examples of some of these. It is the aim of this page to show you how
Javascript can write and execute code.