Category:JavaScript

From Uweb

Jump to: navigation, search

JavaScript (an implementation of the ECMAScript standard) is a scripting language that can be used to perform tasks or "functions" on web pages running inside of a web client (browser). Because of this, JavaScript is commonly referred to as a 'client-side' scripting language, although other implementations of the language exist.

JavaScript has nothing to do with Java.

Modern, standards-compliant JavaScript uses the DOM, aka Document Object Model to manipluate HTML elements, their attributes, and their CSS properties in the web browser. An element can include tag groups (and their content) like HTML table cells, DIVs, Spans, inputs, etc. An example of DOM manipulation is to perform validation on a form field, and then to show a message next to the form field to indicate that it's content didn't pass validation.

Another frequent use of JavaScript is to replace the contents of an HTML element wholesale from the response a web request (HTTP POST using an XHR) rather than to manipulate the DOM structure using numerous function calls. Prototype's Ajax.Updater() makes doing this ridiculously easy and is quite handy for this purpose.

The primary use of JavaScript in the web browser is for event-driven programming (making things happen on click of button etc.) so as to respond to the user (i.e. form field validation). JavaScript code that interacts with elements won't execute as the browser loads unless you place it in the body of the HTML document lower in the page than the elements that you're attempting to manipulate.

There are several JavaScript frameworks and libraries that make life much easier. Among those are Scriptaculous, Prototype, and OpenRico. The Firebug extension to Firefox is a great tool for debugging JavaScript. It can be found at http://getfirebug.com/.

WARNING: JavaScript is a prototypical language and it supports duck typing which makes it a good deal more like Ruby than other more strongly typed Object Oriented languages like Java, C#, or C++. So don't go thinking JavaScript is Java lite or it will cause you considerable grief. For more on the ins and outs of JavaScript, please see quirksmode.org and crockford.com

Pages in category "JavaScript"

The following 12 pages are in this category, out of 12 total.

A

D

J

J cont.

P

R

U

U cont.

Personal tools