JavaScript--The Next Wave In Interactivity
By Sal Familia, TechWeb Technical Editor
No, it's not Java. No, you don't have to be an experienced
programmer to use it. No, it doesn't cost anything. And yes, it will
help make your web pages smarter, hotter and more interactive.
If you've heard about JavaScript, then perhaps I've answered some
of your more pressing questions. And even if you haven't heard of JavaScript, you’ve probably seen it in action without realizing it. JavaScript is appearing everywhere.
JavaScript’s life began as LiveScript, a scripting language
developed by Netscape Communications Corp. for its Navigator web browser. In its
present incarnation, JavaScript is an easy-to-learn, cross-platform,
net-optimized scripting language for creating interactive, live
content for web pages. Currently supported by Netscape
Navigator after version 2.0 and Microsoft's Internet
Explorer 3.0, JavaScript is an important new tool no developer
can afford to ignore. By using it you can create simple interactive
buttons like this:
or program complex, interactive communication between Java
applets, Netscape plug-ins and user input, as well as countless
other applications in-between.
Not Your Father’s Cup Of Joe
Despite the similarity in name, we're actually talking apples and
oranges here. Java is an object-orientated programming language
used to create web-based applets and stand-alone applications.
JavaScript, on the other hand, is a scripting language designed to
enhance HTML. Java is compiled into platform-independant
"bytecode" that is interpreted by the Java Virtual Machine.
JavaScript, like HTML, doesn't require compiling, it is interpreted
line-by-line by the browser.
The following table is from Netscape's JavaScript documentation. It
compares and contrasts JavaScript and Java.
| JavaScript |
Java |
| Interpreted (not compiled) by client. |
Compiled on server before execution on client. |
| Object-based. Code uses built-in, extensible objects, but no classes or
inheritance. |
Object-oriented. Applets consist of object classes with inheritance. |
| Code integrated with, and embedded in, HTML. |
Applets distinct from HTML (accessed from HTML pages). |
| Variable data types not declared (loose typing). |
Variable data types must be declared (strong typing). |
| Dynamic binding. Object references checked at run-time. |
Static binding. Object references must exist at compile-time. |
| Secure. Cannot write to hard disk. |
Secure. Cannot write to hard disk. |
There are both similarities and
differences between the two, but
JavaScript is best suited to assisting web designers in enhancing
the basic functionality of HTML and without requiring advanced
programming skills. Of course, in the hands of a skillful programmer
JavaScript can perform some amazing feats.

