Page 16 - LoudOffice_Guide-to-HTML_Part-II_Advanced.PDF
P. 16

III.    Introduction to JavaScript
               JavaScript is an easy-to-learn programming language that can be built into Web pages, so
               that it executes from within the browser rather than on the web server. Intranets especially
               can leverage the power of JavaScript to create "smart" Web pages that can process data
               and interact with the user. In this introduction, we concisely look at the main programming
               points of the JavaScript language.  This introduction is intended to be very short and brief.
               For a much more in-depth discussion, please visit the LoudOffice.com class website and
               download the Guide to JavaScript there.




               Versions of JavaScript
               There are several versions of JavaScript supported by certain browsers and browser
               versions. Unfortunately, this can often lead to confusion and incompatibilities. Since
               Netscape originally introduced JavaScript, JavaScript 1.0 was the language specification
               supported in Netscape Navigator 2.0. Subsequently, Navigator 3.0 supported new
               enhancements which comprised JavaScript 1.1. At present, Navigator 4.0 versions below
               4.05   inclusive  support   JavaScript  1.2   while  Navigator   4.06+   and   the   Netscape
               Communicator 4.5+ series support JavaScript 1.3.

               Shortly after Netscape's introduction of JavaScript in Navigator 2.0, Microsoft attempted to
               support JavaScript 1.0 in their Internet Explorer 3.0 browser. Known as "Jscript," Microsoft's
               initial JavaScript support was unreliable and buggy. A push to standardize the language
               resulted in an "official" version of JavaScript sanctioned by the ECMA, an international
               standards body. Both Internet Explorer 4.0 JScript and Netscape's JavaScript 1.3 are ECMA-
               compliant and therefore the most compatible with one another. Internet Explorer 5
               introduces additional extensions to the present ECMA standard which are not yet supported
               in kind by Netscape.


               As you can see, the ongoing browser war takes a great toll on web development at the
               JavaScript level. Because of the variation in support for JavaScript/JScript across browser
               revisions, and quite a few exceptions therein, it is impossible to say that any two browser
               versions are completely compatible with one another. For many web developers, authoring
               JavaScript code which gracefully accounts these in JavaScript support is an enormous
               challenge. Intranet developers may have the unique advantage of being able to focus on a
               single version of JavaScript in the case of intranets where only a single version of a single
               browser is deployed. From the developer's perspective, this type of intranet policy greatly
               eases the web development process, increasing both functionality and speed of
               development.




               Embedding JavaScript
               JavaScript code is typically embedded into an HTML document using the SCRIPT tag. You
               are free to embed as many scripts into a single document as you like, using multiple SCRIPT
               tags. A script embedded in HTML with the SCRIPT tag uses the format:

                           < s c r i p t  l a n g u a g e = " J a v a S c r i p t 1 . 2 " >
                           < ! - -  / /  H i d e  F r o m  O l d  B r o w s e r s
                                .  .  .
                           / / U n h i d e  - - >
                           < / s c r i p t >


               LoudOffice.com Guide to HTML – Part II                                               Page 16
   11   12   13   14   15   16   17   18   19   20   21