JavaScript

From Citizendium
Revision as of 00:33, 20 February 2010 by imported>Meg Taylor (copyedit)
Jump to navigation Jump to search
This article is a stub and thus not approved.
Main Article
Discussion
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
 
This editable Main Article is under development and subject to a disclaimer.
JavaScript
Created by Brendan Eich
Typing discipline weak, dynamic

JavaScript is a general-purpose computer scripting language which is frequently embedded in web pages on to make them interactive.

JavaScript is not related to the Java programming language, despite the similar name. JavaScript was originally called LiveScript, but was re-branded due to a deal between Netscape and Sun Microsystems, whereby Netscape used the name JavaScript, a Sun trademark,[1] in return for bundling Sun's Java runtime with the popular Netscape Browser[2]. JavaScript was intended as a complement to Java and so was designed to look similar.

When JavaScript code is embedded in HTML pages, web browsers will execute the JavaScript upon loading the web page. The JavaScript within HTML may also execute in response to user actions on the page. Since in some cases JavaScript may be disabled in the web browser's options, well-designed HTML pages must be functional even if the JavaScript within them is not allowed to execute.

JavaScript has seen several versions since it initial introduction with Netscape Navigator 2.0 in 1995 and the latest version now include new features making it a more robust scripting language. JavaScript script received an added boost when the browser started to expose more of the document object model (DOM) and allowed dynamic changes to the DOM. This gave birth to was to be called Dynamic HTML or DHTML. Not only were HTML elements be exposed to JavaScript programmers, but so were the events allowing JavaScript coded functions to handle those events. No longer were web pages static and it provided a better user interaction with web surfers. Allowing the HTML document to manipulated after the page was served and/or based on user interactions made wave for the next big web technology which made JavaScript indispensable.

The use of JavaScript to communicate in the background with a web server, and then to update small parts of an HTML page asynchronously without the delay or flashing associated with postback (in which the web server sends the browser a completely new HTML page) is broadly called Ajax. In fact, using JavaScript in this manner is so complex that many programmers do not work with JavaScript directly but instead, use one of many Ajax toolkits which group JavaScript into higher functions.

JavaScript has been standardized by the European Computer Manufacturer's Association (ECMA) and is sometimes called ECMAScript. Despite standardization, web browsers from different companies (or even different versions of a browser from the same company) may not handle JavaScript identically. The uneven treatment of JavaScript by different web browsers is the single greatest challenge in JavaScript programming. It is one reasons why so many programmers use a toolkit instead, and it then becomes the responsibility of the toolkit authors to handle the browser differences correctly in JavaScript.

References