JavaScript Session III

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

12-Jun-15 JavaScript Language Fundamentals I. 2 About JavaScript JavaScript is not Java, or even related to Java The original name for JavaScript was.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Javascript Client-side scripting. Up to now  We've seen a little about how to control  content with HTML  presentation with CSS  Javascript is a language.
Chapter 16 Dynamic HTML and Animation The Web Warrior Guide to Web Design Technologies.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
CIS101 Introduction to Computing Week 10 Spring 2004.
25-Jun-15 JavaScript Language Fundamentals II. 2 Exception handling, I Exception handling in JavaScript is almost the same as in Java throw expression.
CIS101 Introduction to Computing Week 10. Agenda Your questions Final exam and final project CIS101 Student Survey Class presentations: Your Mad Libs.
CS 299 – Web Programming and Design Overview of JavaScript and DOM Instructor: Dr. Fang (Daisy) Tang.
JavaScript, Third Edition
The Web Wizard’s Guide To JavaScript Chapter 5 More Image Swapping.
BEST PRACTICES - Java By Configuration Use global-forwards/results Helps to avoid duplicate jsp files and redundancy forward mapping.
SYST Web Technologies SYST Web Technologies Lesson 6 – Intro to JavaScript.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
1 JavaScript. 2 What’s wrong with JavaScript? A very powerful language, yet –Often hated –Browser inconsistencies –Misunderstood –Developers find it painful.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
1 Session 3: Flow Control & Functions iNET Academy Open Source Web Programming.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Functions.
Using Client-Side Scripts to Enhance Web Applications 1.
Keeping it Neat: Functions and JavaScript Source Files Chapter 7.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
ECA 225 Applied Interactive Programming ECA 225 Applied Online Programming images.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
JavaScript, Fourth Edition Chapter 4 Manipulating the Browser Object Model.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Working with Windows (No audio component) © Dr. David C. Gibbs
Week 12 - Monday.  What did we talk about last time?  Defining classes  Class practice  Lab 11.
Tutorial 11 1 JavaScript Operators and Expressions.
PHP Reusing Code and Writing Functions 1. Function = a self-contained module of code that: Declares a calling interface – prototype! Performs some task.
Chapter 6 Murach's JavaScript and jQuery, C6© 2012, Mike Murach & Associates, Inc.Slide 1.
CIS 228 The Internet 11/17/11 Of Timers and Cookies.
JavaScript and Ajax (JavaScript Functions) Week 5 Web site:
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
JavaScript Tutorial. What is JavaScript JavaScript is the programming language of HTML and the Web Programming makes computers do what you want them to.
JavaScript Tutorial First lecture 19/2/2016. Javascript is a dynamic computer programming language. It is lightweight and most commonly used as a part.
The Web Wizard’s Guide To JavaScript
Test 2 Review Outline.
“Under the hood”: Angry Birds Maze
© 2015, Mike Murach & Associates, Inc.
JavaScript: Functions
SEEM4570 Tutorial 05: JavaScript as OOP
Scope, Objects, Strings, Numbers
JavaScript Syntax and Semantics
PHP Training at GoLogica in Bangalore
The Web Wizard’s Guide To JavaScript
JavaScript.
Week#2 Day#1 Java Script Course
HTML5 Level II Session II
ITI 133 HTML5 Desktop and Mobile Level I
JavaScript & jQuery Session I
HTML5 Level I Session II Chapter 3 - How to Use HTML to Structure a Web Page
© 2015, Mike Murach & Associates, Inc.
HTML5 Level I Session III
HTML5 Level I Session III
Chapter 6 Methods: A Deeper Look
Functions, Regular expressions and Events
University of Kurdistan
The Web Wizard’s Guide To JavaScript
The Internet 11/22/11 Conditionals and Loops
HTML5 Course Review Master a Skill / Learn for Life.
HTML5 Session II Chapter 2 - How to Code, Test and Validate a Web Page Chapter 3 - How to Use HTML to Structure a Web Page
Master a Skill / Learn for Life
The <script> Tag
Chapter 4 - JavaScript Events, Objects, & Functions
JavaScript & jQuery Introduction
Strings and Dates in JavaScript
ITI 133: HTML5 Desktop and Mobile Level I
Murach's JavaScript and jQuery (3rd Ed.)
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Intro to Programming (in JavaScript)
Presentation transcript:

JavaScript www.profburnett.com Session III Chapter 7 - JavaScript Links, Images, & Timers Chapter 13 - How to Work with Number, Strings and Dates Chapter 14 - How to Work with Control Structure Exceptions and Regular Expressions www.profburnett.com Master a Skill / Learn for Life 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Chapter 7 - JavaScript Links, Images, & Timers 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

How to preload an image with the Image object How to create an Image object var image = new Image(); How to load an image in an Image object image.src = "image_name.jpg"; How to preload all images referenced by the href attributes of <a> tags var links = document.getElementsByTagName("a"); var i, link, image; for (i = 0; i < links.length; i++) { link = links[i]; image = new Image(); image.src = link.href; } 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Image Swap Application 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Two methods for working with a timer that calls a function once setTimeout( function, delayTime ) // creates a timer clearTimeout ( timer ) // cancels a timer Two methods for working with a timer that calls a function repeatedly setInterval( function, intervalTime ) // creates a timer clearInterval ( timer ) // cancels a timer 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Slide Show Application 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Student Exercise 1 Chapter 7-1 and 7-2 1. Complete Chapter 7 - Exercise 7-1 and 7-2 on Page 219 using Dreamweaver. 2. Students will upload test files to development site. 3. Students will preview in browser development files. 4. Students will upload files to live site. 5. Students will preview in browser live files. 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Chapter 13 - How to Work with Number, Strings and Dates 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Working with Numbers Do Not Declare Strings, Numbers, and Booleans as Objects! When a JavaScript variable is declared with the keyword "new", the variable is created as an object: var x = new String();        // Declares x as a String object var y = new Number();        // Declares y as a Number object var z = new Boolean();       // Declares z as a Boolean object Avoid String, Number, and Boolean objects. They complicate your code and slow down execution speed. 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Math Object JavaScript Math Object JavaScript Math Reference The JavaScript Math object allows you to perform mathematical tasks on numbers. Math.PI;            // returns 3.141592653589793 Math Constructor Unlike other global objects, the Math object has no constructor. Methods and properties are static. All methods and properties (constants) can be used without creating a Math object first. JavaScript Math Object JavaScript Math Reference 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

PIG Application PIG Application 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Working with Strings JavaScript Strings JavaScript String Methods Warning - Don't create strings as objects. It slows down execution speed. The “new” keyword complicates the code. This can produce some unexpected results. JavaScript Strings JavaScript String Methods JavaScript String Reference 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Working with Date and Time and the Data Object JavaScript Data Formats JavaScript Get Date Methods JavaScript Set Date Methods JavaScript Date Objects 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

How the Constructor for the Date Object works If you call the Date constructor with no parameters, it creates a new Date object and sets it to the current date and time. If you call the Date constructor with a string as the parameter, the constructor parses the string as a date or a date and time and uses it to create a new Date object. However, you may get unexpected results if you don’t use slashes and a 4-digit year in the parameter. If you call the Date constructor with two or more numbers as parameters, the numbers are used in the order shown above to create a new Date object. In this case, year and month are required, but the remaining parameters are optional. If you call the Date constructor with another Date object as the parameter, it creates a new Date object that is a copy of the other Date object. If you call the Date constructor with parameters that aren’t a valid date, it creates a new Date object that contains “Invalid Date”. 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Count Down Application 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Student Exercise 2 Chapter 13-1 1. Complete Chapter 13 - Exercise 13-1 on Page 399 using Dreamweaver. 2. Students will upload test files to development site. 3. Students will preview in browser development files. 4. Students will upload files to live site. 5. Students will preview in browser live files. 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Chapter 14 - How to Work with Control Structure Exceptions and Regular Expressions 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

JavaScript Control Structures and Exceptions Comparison Operators Conditional Statements Switch Statement Loop For Statements Loop While Statements Break / Continue Statement Type Conversion Statement Bitwise Operators 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Invoice Application Invoice Application 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Handling Exceptions try catch throw finally Error Object JavaScript Errors JavaScript Error Reference 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

JavaScript Regular Expression Object JavaScript Regular Expressions JavaScript RegExp Reference Two ways to create a regular expression object By using the RegExp() constructor var variableName = new RegExp("expression"[, "flags"]); By coding a regular expression literal var variableName = /expression/[flags]; 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Account Profile Application 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett

Student Exercise 3 Chapter 14-2, and 14-3 1. Complete Chapter 14 - Exercise 14-2, and 14-3 on Page 433 using Dreamweaver. 2. Students will upload test files to development site. 3. Students will preview in browser development files. 4. Students will upload files to live site. 5. Students will preview in browser live files. 9/12/2019 Copyright ©2015 - 2019 Carl M. Burnett