Web Development & Design Foundations with H T M L 5

Slides:



Advertisements
Similar presentations
JavaScript Describe common uses of JavaScript in Web pages.
Advertisements

Web Development & Design Foundations with XHTML Chapter 14 Key Concepts.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
JavaScript Part 1.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
 2000 Deitel & Associates, Inc. All rights reserved. Outline 8.1Introduction 8.2A Simple Program: Printing a Line of Text in a Web Page 8.3Another JavaScript.
Assignment statement: Assigns a value to a variable Variable must appear on the left side, value on the right side of the assignment operator Right side.
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.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
Web Development & Design Foundations with XHTML Chapter 14 Key Concepts.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.
CHAPTER 10 JAVA SCRIPT.
Chapter 6 JavaScript: Introduction to Scripting
Web Development & Design Foundations with HTML5
2.5 Another Java Application: Adding Integers
Web Development & Design Foundations with HTML5 7th Edition
Web Development & Design Foundations with HTML5 7th Edition
Web Development & Design Foundations with H T M L 5
Trigonometry Second Edition Chapter 5
WEB PROGRAMMING JavaScript.
Web Development & Design Foundations with H T M L 5
Web Development & Design Foundations with H T M L 5
Precalculus Essentials
Precalculus Essentials
Web Development & Design Foundations with H T M L 5
Precalculus Essentials
Precalculus Essentials
Precalculus Essentials
Precalculus Essentials
Precalculus Essentials
Precalculus Essentials
Web Development & Design Foundations with H T M L 5
Web Development & Design Foundations with H T M L 5
Precalculus Essentials
Precalculus Essentials
Web Development & Design Foundations with H T M L 5
Precalculus Essentials
Web Development & Design Foundations with H T M L 5
Web Development & Design Foundations with H T M L 5
Web Development & Design Foundations with H T M L 5
Precalculus Essentials
CS105 Introduction to Computer Concepts
Precalculus Essentials
Precalculus Essentials
Precalculus Essentials
Web Development & Design Foundations with H T M L 5
JavaScript Part 2.
Web Development & Design Foundations with H T M L 5
Thinking Mathematically
Thinking Mathematically
Acute Angles and Right Triangles
Thinking Mathematically
Thinking Mathematically
Introduction to Calculus
Precalculus Essentials
Precalculus Essentials
Thinking Mathematically
JavaScript: Introduction to Scripting
Precalculus Essentials
Web Programming– UFCFB Lecture 13
A Survey of Mathematics with Applications
CS105 Introduction to Computer Concepts JavaScript
Thinking Mathematically
Web Development & Design Foundations with HTML5 7th Edition
Presentation transcript:

Web Development & Design Foundations with H T M L 5 Ninth Edition Chapter 14 A Brief Look at JavaScript and jQuery If this PowerPoint presentation contains mathematical equations, you may need to check that your computer has the following installed: 1) MathType Plugin 2) Math Player (free versions available) 3) NVDA Reader (free versions available) Slides in this presentation contain hyperlinks. JAWS users should be able to get a list of links by using INSERT+F7 Copyright © 2019, 2017, 2015 Pearson Education, Inc. All Rights Reserved

Variable var userName; A variable is a placeholder for information. The variable is stored in the computer’s memory (RAM). var userName; userName = "Karen"; document.write(userName);

Hands-on practice 14.4 Pages 584-6 chapter14/14.4/var.html

Prompts prompt() method Displays a message and accepts a value from the user myName = prompt(“prompt message”); The value typed by the user is stored in the variable myName

Hands-on practice 14.5 Page 586-7 chapter14/14.5/var3.html

Arithmetic Operators Operator Description Example Value of Quantity = assign quantity = 10 10 + addition quantity = 10 + 6 16 - subtraction quantity = 10 - 6 4 * multiplication quantity = 10 * 2 20 / division quantity = 10 / 2 5

Sample values of quantity that would result in true Comparison Operators Operator Description Example Sample values of quantity that would result in true = = Double equals sign (equivalent) “is exactly equal to” quantity = = 10 10 > Greater than quantity > 10 11, 12 (but not 10) > = Greater than or equal to quantity > = 10 10, 11, 12 < Less than quantity < 10 8, 9 (but not 10) < = Less than or equal to quantity < = 10 8, 9, 10 ! = Not equal to quantity ! = 10 8, 9, 11 (but not 10)

Decision Making if (condition) { … commands to execute if condition is true } else { … commands to execute if condition is false

Hands-on practice 14.6 Pages 580-1 chapter14/14.6/if.html

Function A function is a block of one or more JavaScript statements with a specific purpose, which can be run when needed. function function_name() { ... JavaScript statements … }

Using Functions Defining the Function Calling the Function function showAlert() { alert("Please click OK to continue."); } Calling the Function showAlert();

Hands-On Practice 14.7 Page 593-4 chapter14/14.7Oif2.html

Form Validation It is common to use JavaScript to validate form information before submitting it to the web server. Is the name entered? Is the e-mail address of correct format? Is the phone number in the correct format? See Hands-on Practice 14.8

Validating Form Fields Use the "" or null to check to determine if a form field has information if (document.forms[0].userName.value == "" ) { alert("Name field cannot be empty."); return false; } // end if

Hands-on practice 14.8 Pages 596-600 chapter14/14.8/form.html

JavaScript & Accessibility Don’t expect JavaScript to always function for every visitor Some may have JavaScript disabled Some may be physically unable to click a mouse Provide a way for your site to be used if JavaScript is not functioning Plain text links E-mail contact info