JavaScript: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Pat Palmer
(first draft)
 
mNo edit summary
 
(30 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{subpages9}}
{{subpages}}
'''Javascript''' is a [[computer]] [[programming language]].  Javascript is not the same as [[Java]], although its [[syntax]] is remarkably similarJavascript code can be embedded in [[HTML]] pages[[Web browser]]s will then execute the Javascript before displaying the web page for the user, or in response to user actions on the page, unless Javascript has been disabled in the web browser's optionsJavascript is standardardized by the European Computer Manufacturer's Association ([[ECMA]]) and is, these days, occasionally referred to as ECMA-script.
{{Infobox Programming Language
| name    = JavaScript
| creator  = Brendan Eich
| typing  = weak, dynamic
}}
'''JavaScript''' is a general-purpose computer [[programming language]] defined by a series of standards by [[ECMA International]] (ECMA) and known as ''ECMAScript''JavaScript runs in a web browser to help make [[web page]]s interactiveDespite 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 programmingIt is one reasons why so many programmers use a toolkit (Javascript library) such as [[jQuery]] instead, and it then becomes the responsibility of the library authors to handle the browser differences correctly in JavaScript.


!!!HTML and JavaScript slides (Powerpoint):  
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,<ref>[http://www.sun.com/suntrademarks/ Sun Trademarks]</ref> in return for bundling Sun's Java runtime with the popular [[Netscape Browser]]<ref>http://web.archive.org/web/20080213171613/wp.netscape.com/newsref/pr/newsrelease67.html</ref>. JavaScript was intended as a complement to Java and so was designed to look similar.


*[[http://alliance.seas.upenn.edu/~cis700/Lectures/1-html-and-forms.ppt|HTML and Forms]]
When JavaScript code is embedded in [[HTML]] pages, [[web browser]]s will execute the JavaScript upon loading the web page, and some Javascript may execute when the user interacts with elements in 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.
*[[http://alliance.seas.upenn.edu/~cis700/Lectures/2-basic-javascript.ppt|JavaScript I]]
*[[http://alliance.seas.upenn.edu/~cis700/Lectures/3-intermediate-javascript.ppt|JavaScript II]]
*[[http://alliance.seas.upenn.edu/~cis700/Lectures/4-advanced-javascript.ppt|JavaScript III]]
*[[http://alliance.seas.upenn.edu/~cis700/Lectures/5-js-and-html.ppt|JavaScript and HTML]]
*[[http://alliance.seas.upenn.edu/~cis700/Lectures/6-js-examples.ppt|JavaScript Examples]]


!!!A Concise Introduction to JavaScript
JavaScript has seen several versions since its 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; HTML elements became available to JavaScript programmers, as were the events allowing JavaScript coded functions to handle those events.  This provided a better user experience for web surfers.  Allowing the HTML document to manipulated after the page was served and/or based on user interactions made JavaScript important for the world wide web.


* [[http://www.cis.upenn.edu/~matuszek/General/JavaScript/concise-javascript-1.html|Part I: The Core Language]]
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 (web technology)|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.  
* [[http://www.cis.upenn.edu/~matuszek/General/JavaScript/concise-javascript-2.html|Part II: Client-side JavaScript]]


JavaScript supports all the structured programming syntax of C (e.g., if statements, while loops, switch statements, etc.). JavaScript is almost object-based. JavaScript relies on a run-time environment.


Tutorial: %newwin% [[http://www.w3schools.com/js/default.asp|http://www.w3schools.com/js/]]
==References==
 
{{reflist}}[[Category:Suggestion Bot Tag]]
 
!!!Pat's Javascript examples from last year:
 
* [[http://slayeroffice.com/articles/innerHTML_alternatives/ | Alternatives to innerHTML]]
*[[http://harbormist.com/cis700/examples.html#Example_4 | ''Inlining'' an HTML table's background]]
*[[http://harbormist.com/cis700/examples.html#Example_6 | Capability report for web browsers]]
*[[http://harbormist.com/cis700/examples.html#Example_7 | Widgets and events]]

Latest revision as of 11:00, 4 September 2024

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 programming language defined by a series of standards by ECMA International (ECMA) and known as ECMAScript. JavaScript runs in a web browser to help make web pages interactive. 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 (Javascript library) such as jQuery instead, and it then becomes the responsibility of the library authors to handle the browser differences correctly in JavaScript.

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, and some Javascript may execute when the user interacts with elements in 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 its 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; HTML elements became available to JavaScript programmers, as were the events allowing JavaScript coded functions to handle those events. This provided a better user experience for web surfers. Allowing the HTML document to manipulated after the page was served and/or based on user interactions made JavaScript important for the world wide web.

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 supports all the structured programming syntax of C (e.g., if statements, while loops, switch statements, etc.). JavaScript is almost object-based. JavaScript relies on a run-time environment.

References