JavaScript

JavaScript is an object-based but not object-oriented (it doesn't support inheritance or polymorphism) programming language from Netscape that's superficially similar to Java. Where Java is a semi-compiled/semi-interpreted language, JavaScript is fully interpreted. Furthermore JavaScript is embedded directly in a web page rather than being included from a separate file. A JavaScript also has access to the items on the page it's included on so it can do things like browser detection. For example, I use the following simple JavaScript on many of my pages to prevent illegal mirrors:

<SCRIPT LANGUAGE=JAVASCRIPT>
/* Only sunsites are allowed to mirror this page and then
only with explicit, prior permission. For details,
send email to elharo@metalab.unc.edu */
if (location.protocol.toLowerCase().indexOf("file") != 0 ) { 
  if (location.host.toLowerCase().indexOf("sunsite") < 0) {
    location.href="http://metalab.unc.edu/javafaq/books.html";
  }
}
</SCRIPT>
There are many good books about JavaScript (and not a few bad ones, I'm sure).


Previous | Next | Top
Last Modified April 22, 1999
Copyright 1997, 1999 Elliotte Rusty Harold
elharo@metalab.unc.edu