In contrast, JavaScript descends in spirit from a line of
smaller,
dynamically typed languages like HyperTalk and dBASE. These
scripting
languages offer programming tools to a much wider audience
because of their
easier syntax, specialized built-in functionality, and
minimal requirements
for object creation.
I'd be careful about characterizing JavaScript as
"watered-down" JAVA, though I understand why Netscape would
want to make this case. JavaScript does make the definition
of functions relatively easy, but JavaScript is not a
language that you can learn overnight (as HTML can be).
Flanagan warns, "complete mastery of JavaScript requires
sophisticated programming skills".
The two languages complement one another primarily because
they address different uses of a browser. If, for example,
you want to play chess or backgammon over the web, a JAVA
applet is in order, because JAVA is appropriate for web
networking.
If, on the other hand, you want to create an interactive,
"form" driven page, JavaScript is the way to go. For
example, if you wanted to design a homepage with radio
buttons which gave the visitor to your site specific
options, you can use a JavaScript script to generate "custom
made" web pages for the visitor, and do so, "on the fly". A
CGI script could accomplish this task as well, but only when
a form is submitted and processed. JavaScript, since it
runs at the browser level, independent of the server, can
respond instantly to "events" such as the selection of a
radio button.
JavaScript can be used to write text into html documents as
they are parsed (with the write method), and it can control
the behavior of the browser (e.g. it can open and close new
browser windows). And, of course, JavaScript is useful in
modifying the manner in which text appears in browser
windows.
Jim also wrote......
JavaScript complements Java by exposing useful properties of
Java applets to script authors. JavaScript statements can
get and set exposed properties to query the state or alter
the performance of an applet or plug-in.
This is true only with Netscape 3.0 (or higher), but really
adds some punch to JavaScript. This ability, called
"LiveConnect", permits JavaScript to work with the JAVA
interpreter in the browser to control JAVA applets and
plug-ins. Of course, LiveConnect also makes it possible for
JAVA applets and JAVA-oriented plug-ins to read and interact
with JavaScripts as well.
If all of this makes you want to dash right out and start
writing JavaScript scripts and JAVA applets, be warned:
these languages are not without bugs (particularly
JavaScript).
A great site for JavaScript developers is
Be sure to check out the bug page, at
http://developer.netscape.com/library/javascript/faqs/buglist/js-known-bugs.html
JAVA is also a little buggy, and has its own security
problems. For more info, you might want to visit the
Hostile Applets Home page
http://www.med.umich.edu/hypermail/fp.talk/0303.html
Regards,
Warner Winborne
University Honors Program
wwinborne@niu.edu