Javascript Programming

Information Technology Resources

JavaScript is the name of Netscape Communications Corporation's implementation of ECMAScript, a scripting programming language based on the concept of prototypes. The language is best known for its use in websites, but is also used to enable scripting access to objects embedded in other applications.

Despite the name, JavaScript is only distantly related to the Java programming language, the main similarity being their common debt to the C programming language. JavaScript has far more in common with the Self programming language.

JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape.

History

JavaScript was originally developed by Brendan Eich of Netscape Communications Corporation under the name Mocha, then LiveScript, and finally renamed to JavaScript. The change of name from LiveScript to JavaScript roughly coincided with Netscape adding support for Java technology in its Netscape Navigator web browser. JavaScript was first introduced and deployed in the Netscape browser version 2.0B3 in December of 1995. When web developers talk about using JavaScript in Internet Explorer, they are actually using JScript. The choice of name proved to be a source of much confusion.

As of 2005, the latest version of the language is JavaScript 1.6, which corresponds to ECMA-262 Edition 3 like JavaScript 1.5, except for Array extras, and Array and String generics. ECMAScript, in simple terms, is a standardized version of JavaScript. The ECMA-357 standard specifies E4X, a language extension dealing with XML.

Usage

JavaScript is a prototype-based scripting language with a syntax loosely based on C. Like C, the language has no input or output constructs of its own. Where C relies on standard I/O libraries, a JavaScript engine relies on a host environment into which it is embedded. There are many such host environment applications, of which web technologies are the most well known examples. These are examined first.

One major use of web-based JavaScript is to write functions that are embedded in or included from HTML pages and interact with the Document Object Model (DOM) of the page to perform tasks not possible in HTML alone. Some common examples of this usage follow.

- Opening or popping up a new window with programmatic control over the size, position and 'look' of the new window (i.e. whether or not the menus, toolbars etc are visible. Usually JavaScript is used to ensure that they are not)

- Checking or validating web form input values to make sure that they will be accepted before they are submitted to the server

- Changing images as the mouse cursor moves over them

- Animating fonts and graphics without the need to make roundtrips to the webserver.

Unfortunately, the DOM interfaces in various browsers differ and don't always match the W3C DOM standards. Rather than write different variants of a JavaScript function for each of the many browsers in common use today, it is usually possible, by carefully following the W3C DOM Level 1 or 2 standards, to provide the required functionality in a standards-compliant way that most browsers will execute correctly. Care must always be taken to ensure that the web page degrades gracefully and so is still usable by any user who:

- has JavaScript execution disabled - for example as a security precaution

- has a browser that does not understand the JavaScript - for example on a PDA or mobile phone

- is visually or otherwise disabled and may be using an unusual browser, a speech browser or may have selected extreme text magnification. For more information on this, see the Web Accessibility Initiative.

Other examples of JavaScript interacting with a web page's DOM have been called DHTML and SPA.

A different example of the use of JavaScript in web pages is to make calls to web and web-service servers after the page has loaded, depending upon user actions. These calls can obtain new information, which further JavaScript can merge with the existing page's DOM so that it is displayed. This is the basis of Ajax programming.

Outside of the Web, JavaScript interpreters are embedded in a number of tools. Adobe Acrobat and Adobe Reader support JavaScript in PDF files. The Mozilla platform, which underlies several common web browsers, uses JavaScript to implement the user interface and transaction logic of its various products. JavaScript interpreters are also embedded in proprietary applications that lack scriptable interfaces. Dashboard Widgets in Apple's Mac OS X v10.4 are implemented using JavaScript. Microsoft's Active Scripting technology supports JavaScript-compatible JScript as an operating system scripting language. JScript .NET is a CLI-compliant language that is similar to JScript, but has further object oriented programming features. Tools in the Adobe Creative Suite, including Photoshop, allow scripting through JavaScript.

Each of these applications provides its own object model which provides access to the host environment, with the core JavaScript language remaining mostly the same in each application.

Links

Javascripts.com : Hundreds of javascripts, news, articles to enhance your website looks and performance.

Dynamic Drive: Dynamic Drive, provides free, original DHTML & Javascripts to enhance your web site! Your usage of their scripts, however, is subject to certain terms and conditions. Please read the terms carefully before you download them.

ScriptSearch: ScriptSearch.com serves the Internet community as the largest and most well-known programming directories anywhere. Now owned by internet.com Corporation (formerly Mecklermedia Corporation), the ScriptSearch site has undergone a complete redesign and relaunch in early 2001 in order to better tune the site for you, the visitor.ScriptSearch's comprehensive programming directory is more intuitively organized by programming language with subfolders with various script categories.

The Javascript Source - The JavaScript Source is an excellent JavaScript resource with tons of "cut and paste" JavaScript examples for your Web pages. All for free! We have put together a collection of hundreds of free JavaScripts that are available to you for use on your web pages. The scripts are available via a user friendly interface -- including a working JavaScript example of all the scripts and a text box with the complete actual JavaScript code used. We also have a great JavaScript books section if you would like to learn JavaScript, and a JavaScript Help Forum where you can post script requests, script questions, and more. Check it out!

CodeLifter.com Free JavaScript Archive : Ya gotta get a look at these really great web effects that you can quickly and easily insert into your page. CodeLifter is a CodeBrain.com Sister Site.

CodeBrain.com: : The CodeBrain site is comprised of some 450+ pages, devoted to JAVA, Perl, JavaScript, and web site development resources and issues. Contains very useful ready to use java applets for your use. Some of the applets are for sale and some are free to download. CodeBrain is constantly adding new scripts, applets, and software. If you do not receive our newsletter, now might be a good time to subscribe.

Dynamic Drive No fluff. Just a lot of great DHTML scripts. Welcome to Dynamic Drive, the premier place on the net to obtain free, original DHTML scripts and components to enhance your web site. All scripts on this site take advantage of the latest in JavaScript and DHTML technology, with emphasis on practicality and backwards compatibility, to bring true power and interactivity to your site. Enjoy!

Java-Scripts.net - Welcome to Java-scripts.net, a great little place to find cool and useful JavaScripts for your site! All scripts on this site come with easy-to-follow installation instructions, along with a live demonstration. Want some free traffic? Submit your free javascript to us and we will add it to our archive and link it back to your site. Want to learn javascript? Now you can! Get started with this site navigation tutorial.

JavaScript City - A guide to free JavaScripts, tutorials, and resources. Find free cut and paste JavaScripts to add to your site to perform various tasks. Instructions on how to install and use the scripts are included with most of the scripts. JavaScript Tutorials on cut and paste JavaScript topics, plus links to sites which teach you how to write javascripts on your own. Also include JavaScript Discussion Forums, Information and Documentation Sites which offer information on the JavaScript language, Script Submission option and more.

JavaScript Toolbox - This site is intended to be a repository of code and reusable libraries which address common needs that many web developers encounter. The code found here is based on standards but also tries to be backwards-compatible for browsers which don't support the standards.

Nic's JavaScript Source a collection of thousands of free JavaScripts that are available to you for use on your Web pages. The scripts are available via a user friendly interface — including a working JavaScript example of most of the scripts and a text box with the complete actual JavaScript code used. To start, just select a category from the navigation menu at the left or look at the latest scripts listed on the home page.

JavaScript Kit - Formerly Website Abstraction, JavaScript Kit offers Scripts, JS tutorials, Advanced JS tutorials, Applets, Web Tutorials, DHTML, Forum and Freewarejava.

ZDNet Developer ScriptLibrary - ZDNet, www.zdnet.com, operates a worldwide network of web sites that offer content, services, and commerce opportunities that enable IT professionals and business influencers to gain an edge in business. Winner of the Computer Press Association's "Best Overall Site" award for two consecutive years, ZDNET provides an invaluable perspective and resources so that users can get the most out of their investments in technology.

HotScripts.com HotScripts.com is an Internet directory that compiles and distributes Web programming-related resources. HotScripts.com is geared toward webmasters and programmers who are looking to enhance their Web sites and intranets with dynamic development tools. With thousands of Web programming resources available on the Internet today, our mission is to provide Web developers with the best collection of quality programming information and resources in the most convenient fashion.

Share This


Suggestions for Further Reading

Attribution: Some information for this article has been adapted from wikipedia under GNLU licence.