JavaScript

From Citizendium
Revision as of 21:22, 2 December 2007 by imported>Pat Palmer
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 is a general-purpose computer programming language that is frequently embedded within HTML pages on the World Wide Web to make pages more interactive. Javascript is not the same as Java, although its syntax is remarkably similar. When Javascript code is embedded in HTML pages, Web browsers will then execute the Javascript before displaying the web page for the user. 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, HTML pages must be functional even if the Javascript within them is not allowed to execute.

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 standardardized by the European Computer Manufacturer's Association (ECMA) and is, these days, occasionally referred to as ECMA-script. 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.