The Web Wizard - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

The Web Wizard

Description:

The Web Wizard s Guide To JavaScript Chapter 1,2 JavaScript Basics Fundamental Concepts Objects: The nouns of the language Instances: incarnations of objects ... – PowerPoint PPT presentation

Number of Views:152
Avg rating:3.0/5.0
Slides: 11
Provided by: Steven853
Learn more at: http://www.cs.gsu.edu
Category:
Tags: green | slides | web | wizard

less

Transcript and Presenter's Notes

Title: The Web Wizard


1
The Web Wizards Guide To JavaScript
  • Chapter 1,2
  • JavaScript Basics

2
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

3
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

4
Sequence
  • Doing Things in a Given Order
  • Browsers execute statements in the order they are
    received.
  • Statements are placed in the HEAD within the
    ltscriptgtlt/scriptgt tag.

5
Loops
  • Doing things repeatedly
  • The for loop
  • Initial expression
  • Test condition
  • Update expression

6
Conditional Branching
  • Code that makes decisions
  • The if-else structure
  • Test a condition
  • One set of statements if condition is true
  • Another set of statements if condition is false
  • Take care to not confuse assignment () with
    equality ()

7
Where to Placing Scripts
  • Scripts can go in the HEAD or the BODY
  • Event handlers in BODY send values to functions
    in HEAD

8
Code Libraries
  • Reuse your favorite scripts
  • Store code libraries in plain text files
  • Use the .js extension for code libraries
  • Reference your source libraries using the script
    tag.
  • ltscript type"text/javascript" language"javascrip
    t" src"mylibrary.js"gt

9
A Page to Make HTML Code
  • Place the buildPage() function in mylibrary.js
  • The pagecontent variable stores code for an html
    page
  • The contents of pagecontent are placed in an
    on-screen text field.

10
A Page to Test Code
  • Visitors type code into a text field
  • The eval() function executes the code
  • For Example window.document.bgColor'green'
Write a Comment
User Comments (0)
About PowerShow.com