Chapter 2 Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc.Slide 1.

Slides:



Advertisements
Similar presentations
Chapter 7 JavaScript: Introduction to Scripting. Outline Simple Programs Objects and Variables Obtaining User Input with prompt Dialogs – –Dynamic Welcome.
Advertisements

/ 251 Internet Applications Ahmed M. Zeki Sem – / Chapter 8.
Introducing JavaScript
Murach’s JavaScript, C3© 2009, Mike Murach & Associates, Inc.Slide 1.
Murach’s JavaScript, C2© 2009, Mike Murach & Associates, Inc. Slide 1.
Murach’s JavaScript, C1© 2009, Mike Murach & Associates, Inc. Slide 1.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Murach’s JavaScript, C5© 2009, Mike Murach & Associates, Inc.Slide 1.
Murach’s JavaScript, C2© 2009, Mike Murach & Associates, Inc.Slide 1.
Murach’s JavaScript, C13© 2009, Mike Murach & Associates, Inc.Slide 1.
Murach’s JavaScript, C1© 2009, Mike Murach & Associates, Inc.Slide 1.
Murach's C# 2012, C7© 2013, Mike Murach & Associates, Inc.Slide 1.
JavaScript: Control Structures September 27, 2005 Slides modified from Internet & World Wide Web: How to Program (3rd) edition. By Deitel, Deitel,
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Chapter 3: Data Types and Operators JavaScript - Introductory.
© 2012, Mike Murach & Associates, Inc.
1 JavaScript in Context. Server-Side Programming.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
JavaScript, Fourth Edition
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
1 JavaScript in Context. Server-Side Programming.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Part:2.  Keywords are words with special meaning in JavaScript  Keyword var ◦ Used to declare the names of variables ◦ A variable is a location in the.
Murach, Chapter 5. Common Control Structures Selection: The IF statement Case: The Select Case statement Iteration: Loops 9/28/20082.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Chapter 1 Murach's JavaScript and jQuery, C1© 2012, Mike Murach & Associates, Inc.Slide 1.
Chapter 4 Murach's JavaScript and jQuery, C4© 2012, Mike Murach & Associates, Inc.Slide 1.
Chapter 6 Murach's JavaScript and jQuery, C6© 2012, Mike Murach & Associates, Inc.Slide 1.
Chapter 5 Murach's JavaScript and jQuery, C1© 2012, Mike Murach & Associates, Inc.Slide 1.
REEM ALMOTIRI Information Technology Department Majmaah University.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
© 2010 Robert K. Moniot1 Chapter 6 Introduction to JavaScript.
CSS Colors, JavaScript Variables, Conditionals and Basic Methods
© 2016, Mike Murach & Associates, Inc.
Chapter 6 JavaScript: Introduction to Scripting
© 2016, Mike Murach & Associates, Inc.
© 2009, Mike Murach & Associates, Inc.
© 2015, Mike Murach & Associates, Inc.
Introduction to Scripting
JavaScript Syntax and Semantics
Chapter 19 JavaScript.
Web Systems Development (CSC-215)
The relational operators
© 2015, Mike Murach & Associates, Inc.
CSS Colors, JavaScript Variables, Conditionals and Basic Methods
© Akhilesh Bajaj, All rights reserved.
Chapter 8 JavaScript: Control Statements, Part 2
WEB PROGRAMMING JavaScript.
T. Jumana Abu Shmais – AOU - Riyadh
An Introduction to JavaScript
Tutorial 10: Programming with javascript
JavaScript: Introduction to Scripting
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
© 2017, Mike Murach & Associates, Inc.
Murach's JavaScript and jQuery (3rd Ed.)
Presentation transcript:

Chapter 2 Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc.Slide 1

Objectives Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 2

Objectives (continued) Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 3

Objectives (continued) Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 4

Two attributes of the script element Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 5

A script element that embeds JavaScript in the head section Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 6

Terms Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 7

JavaScript in the body of an HTML document Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 8

The result of the JavaScript in a web browser Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 9

A noscript element in the body of the HTML Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 10

A block of JavaScript code Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 11

The basic syntax rules for JavaScript Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 12

How to split a statement over two or more lines Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 13

Rules for creating identifiers Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 14

Valid identifiers in JavaScript Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 15

Camel casing versus underscore notation Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 16

Naming recommendations Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 17

JavaScript code that includes comments Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 18

The syntax rules for JavaScript comments Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 19

Guidelines for using comments Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 20

Terms Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 21

Common methods of the window object Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 22

A statement that calls the prompt method with the object name omitted Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 23

One property of the window object Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 24

Terms related to objects Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 25

Number, string, and Boolean values Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 26

Terms related to data types Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 27

Common arithmetic operators Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 28

The order of precedence for arithmetic expressions Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 29

Terms related to numeric expressions Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 30

The most useful assignment operators Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 31

How to code compound assignment statements Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 32

Three ways to increment a counter variable Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 33

A floating-point result that isn’t precise Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 34

Terms for working with variables Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 35

The concatenation operator for strings Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 36

Escape sequences that can be used in strings Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 37

How to declare string variables Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 38

How to code compound assignment statements Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 39

How escape sequences can be used in a string Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 40

How to declare Boolean variables and assign values to them Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 41

Terms for string expressions Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 42

How JavaScript interprets the plus sign in mixed expressions Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 43

Two methods of the window object for converting string values Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 44

The same examples with chaining Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 45

Terms Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 46

The relational operators Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 47

The syntax of the global isNaN method Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 48

The logical operators in order of precedence Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 49

Terms for conditional expressions Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 50

The syntax of the if statement Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 51

An if statement with else if and else clauses Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 52

An if statement with a compound conditional expression Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 53

How to test a Boolean variable Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 54

The syntax of a while loop Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 55

The syntax of a do-while loop Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 56

A while loop that gets the average of numbers Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 57

The syntax of a for statement Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 58

A for loop that calculates future value Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 59

Terms for conditional statements Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 60

The Calculate MPG application Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 61

The Calculate MPG application (continued) Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 62

The HTML and JavaScript for the application Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 63

The dialog boxes for the Test Scores application Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 64

The Test Scores application (continued) Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 65

The JavaScript in the HTML head section Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 66

The Firefox Error Console with an error Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 67

How to display the Firefox Error Console and the source code for an error Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 68

Common syntax errors Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 69

Extra 2-1: Convert number grades to letter grades Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 70

Extra 2-1: (continued) Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 71

Extra 2-2: Convert Fahrenheit to Celsius Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 72

Extra 2-3:Calculate income tax Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 73

Extra 2-3: (continued) Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 74

Short 2-1: Enhance the Test Scores application Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc. Slide 75