Chapter 1. Purpose


The purpose of JavaScript is to add an extra layer of usability to a Web page.

That sounds simple, but this golden rule has frequently been misunderstood. Not all scripts add usability to a Web site; in fact, during several periods of JavaScript's checkered history, the creation of flashy-looking but useless scripts has been a significant cottage industry.

Even when writing useful scripts, JavaScript developers haven't always written them in their proper context: that of an accessible, modern HTML page that integrates the insights of the Web standards movement.

Worse, some scripts don't add a usability layer, they are the entire usability layerand as a consequence the site falls apart when a browser doesn't support JavaScript.

We'll discuss usability, accessibility, and the Web standards movements in Chapter 2. The current chapter focuses on explaining JavaScript's purpose in more depth, so that you understand its role in a Web site. In addition, it discusses the constant redefinition of JavaScript's purpose throughout its history.

JavaScript is Not Java

Although the names suggest otherwise, JavaScript is not the same as Java. Granted, there are a few superficial syntactic resemblances, and both languages can be used to add usability to a Web page, but the differences are more important than the similarities.

It's best to see Java and JavaScript as distant cousins. Occasionally you'll notice a family resemblance, but most of the time you're dealing with quite different languages. Knowledge of Java may help you learn the basics of JavaScript, but it may also hinder you, because some aspects of JavaScript, notably its dynamic typing and its use of prototypes instead of classes to support inheritance, are different from Java and require a different programming approach.




ppk on JavaScript. Modern, Accessible, Unobtrusive JavaScript Explained by Means of Eight Real-World Example Scripts2006
ppk on JavaScript. Modern, Accessible, Unobtrusive JavaScript Explained by Means of Eight Real-World Example Scripts2006
ISBN: N/A
EAN: N/A
Year: 2005
Pages: 116

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net