JavaScript
From DocForge
JavaScript is Netscape/Mozilla's implementation of ECMAScript. Most web browsers come with a JavaScript runtime engine which allow web pages to operate dynamically. This gives web sites the ability to alter content and interact with a user from within one web page.
One popular use of JavaScript is in the use of so called "Web 2.0" applications which use a combination of AJAX for server communications and DOM for web page modifications.
JavaScript can also be used for applications outside of the web browser, such as embedding scripting logic inside of a PDF document, however such use is relatively small compared to its widespread use in web programming.
Typically speaking, JavaScript included in a web page will either be a logic block and located inside of HTML's <head> element where it will be used to provide logic for the rest of the page. (For example, unobtrusively adding client-side form validation). An inline JavaScript block is added in somewhere within the HTML's <body> element and generally provides code that gets run along side with the page's rendering. (For example, adding in a Google AdSense JavaScript tag that will render an ad block on the page)
JavaScript has very close bindings with the HTML DOM, and thus the entire DOM is accessible to read and modify from JavaScript methods and functions.
A simple example of changing the background-color of the webpage from JavaScript:
<html>
<head>
<script type='text/javascript'>
function changeBgColor(){
document.getElementByTagName('body')[0].style.backgroundColor = 'red';
}
</script>
</head>
<body style='background-color: blue;'>
<button onclick='changeBgColor();'>Click Me!</button>
</body>
</html>
[edit] JavaScript Libraries
- Prototype is a toolkit for class-driven development and simplification of AJAX. It's very popular as a basis for other larger libraries.
- Script.aculo.us is a library which provides an animation framework, drag and drop, Ajax controls, DOM utilities, and unit testing. It is based around Prototype.
- Dojo is another library, which has (arguably) a better design, etc. than Prototype.
- Mootools is another effects and Ajax library meant to be lighter and more flexible than Prototype and Dojo.
- JQuery is "a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages."
- SAJAX, or Simple AJAX Toolkit, is a Javascript library targeted specifically at AJAX.
- X, a cross-browser.com Javascript library.

