the web wizards guide to javascript chapter 1 javascript basics

6
The Web Wizard’s Guide To JavaScript Chapter 1 JavaScript Basics

Upload: cameron-kane

Post on 26-Mar-2015

225 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: The Web Wizards Guide To JavaScript Chapter 1 JavaScript Basics

The Web Wizard’s Guide To JavaScript

Chapter 1

JavaScript Basics

Page 2: The Web Wizards Guide To JavaScript Chapter 1 JavaScript Basics

Chapter Objectives

• To discover the reasons to learn JavaScript

• To learn the history of JavaScript

• To master the fundamental concepts

• To become familiar with the Document Object Model

Page 3: The Web Wizards Guide To JavaScript Chapter 1 JavaScript Basics

Why Learn JavaScript?

• Broad support among web browsers

• Vast libraries of scripts available online

• Applicable to other host environments

• Allows use of reusable code libraries

• Similar syntax to C, C++, and Java

• Encourages creative problem solving

Page 4: The Web Wizards Guide To JavaScript Chapter 1 JavaScript Basics

A Little History

• Invented by Eich at Netscape in 1995

• Became popular with Navigator 3

• Jscript: Microsoft’s competing language

• ECMA: a standard emerges

Page 5: The Web Wizards Guide To JavaScript Chapter 1 JavaScript Basics

Fundamental Concepts• Objects: The nouns of the language• Instances: incarnations of objects• Properties: attributes of objects• Values: content for properties• Events and Events Handlers• Variables: containers for data• Arrays: ordered collections of data• Methods: The verbs of the language• Operators: Assignment versus Comparison• Functions: groups of statements

Page 6: The Web Wizards Guide To JavaScript Chapter 1 JavaScript Basics

The Document Object Model

• Internal road map of objects on a web page

• Hierarchical model of web browser objects

• Old DOMs for Netscape, Microsoft

• New browsers use the standard DOM by W3C