The Web Wizard’s Guide To JavaScript

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

The Web Wizards Guide To JavaScript Chapter 3 Working with Forms.
Lesson 4: Formatting Input Data for Arithmetic
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic JavaScript: Introduction to Scripting.
Computer Science 103 Chapter 3 Introduction to JavaScript.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
Tutorial 11 Working with Operators and Expressions
The Information School of the University of Washington Oct 20fit programming1 Programming Basics INFO/CSE 100, Fall 2006 Fluency in Information Technology.
JavaScript Events and Event Handlers 1 An event is an action that occurs within a Web browser or Web document. An event handler is a statement that tells.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Introduction to Programming the WWW I CMSC Summer 2003 Lecture 12.
The Web Wizard’s Guide To JavaScript Chapter 1 JavaScript Basics.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Extracting the System Date  Built-in Date() object  Can be manipulated only by creating a new object instance  var variable = new object  var birthDay.
Bridges To Computing General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. You are invited.
The Web Wizard’s Guide To JavaScript Chapter 6 Working with Dates and Times.
The Web Wizard’s Guide To JavaScript Chapter 6 Working with Dates and Times.
Integrating JavaScript and HTML5 HTML5 & CSS 7 th Edition.
1 JavaScript 1. 2 Java vs. JavaScript Java –Is a high level programming language –Is platform independent –Runs on a standardized virtual machine.
 2003 Prentice Hall, Inc. All rights reserved. CHAPTER 3 JavaScript 1.
Dynamic Web Pages & JavaScript. Dynamic Web Pages Dynamic = Change Dynamic Web Pages are web pages that change. More than just moving graphics around.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
Introduction to Programming JScript Six Scripting functions Discuss functions Password Example.
The Web Wizard’s Guide To JavaScript Chapter 7 Cookies: Maintaining State.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
The Web Wizard’s Guide To JavaScript Chapter 8 Working with Windows and Frames.
JavaScript. JavaScript is the programming language of HTML and the Web. Easy to learn One of the 3 languages of all developers MUST learn: 1. HTML to.
The Web Wizard’s Guide To JavaScript Chapter 3 Working with Forms.
The Web Wizard’s Guide To JavaScript Chapter 3 Working with Forms.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
XP Tutorial 2 New Perspectives on JavaScript, Comprehensive1 Working with Operators and Expressions Creating a New Year’s Day Countdown Clock.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
 2003 Prentice Hall, Inc. All rights reserved. Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Introduction to Programming the WWW I CMSC Summer 2003 Lecture 13.
Tutorial 11 1 JavaScript Operators and Expressions.
Section 10.1 Define scripting
Chapter 6 JavaScript: Introduction to Scripting
© 2015, Mike Murach & Associates, Inc.
Chapter 4: HTML5 Media - <video> & <audio>
Web Development & Design Foundations with HTML5 7th Edition
Introduction to Scripting
JavaScript Syntax and Semantics
Introduction to JavaScript
JavaScript: Functions.
JavaScript.
14 A Brief Look at JavaScript and jQuery.
Chapter 7 - JavaScript: Introduction to Scripting
Web Systems Development (CSC-215)
JavaScript: Introduction to Scripting
The Web Wizard’s Guide To JavaScript
INFO/CSE 100, Spring 2005 Fluency in Information Technology
The Web Wizard’s Guide To JavaScript
INFO/CSE 100, Spring 2006 Fluency in Information Technology
Variables and Inheritance Part 1
Learning VB2005 language (basics)
The Web Wizard’s Guide To JavaScript
Tutorial 10: Programming with javascript
JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Strings and Dates in JavaScript
Introduction to JavaScript
Basic program gives only one quess and then the program ends.
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Chapter 7 - JavaScript: Introduction to Scripting
Presentation transcript:

The Web Wizard’s Guide To JavaScript Chapter 6 Working with Dates and Times

Chapter Objectives To understand JavaScript’s Date object To learn how to add a clock to a Web page To find out how to display the time and date in any format you like To see how to add a greeting to a Web page that changes with the time of day To learn how to add a time-sensitive greeting to your Web page clock To discover how to perform calculations based on dates

The Date Object JavaScript contains a set of core objects, including the Date object, that exist independently of any host environment such as a Web browser. To use the Date object, you first create an instance of it and then apply a method to obtain date and time information.

A Simple Clock A quick way to create a simple clock is to use the toLocaleString() method of the Date object, which returns the date and time formatted as text.

Creating a Better Clock To create customized presentations of the time, you obtain the current hour, minute, and seconds using methods of the Date object. These values can be stored as variables and then concatenated (joined together) to create a string of text to express the time.

Creating Dynamic Greetings It is possible to vary the information displayed on your Web page according to the time or date. If code exists in the HEAD to test for the time of day, you can create variable content in the BODY using the document.write() method.

Text Fields vs. document.write() Use document.write() for content that will not change during the visitor’s session. Use text fields for content that requires updating during the visitor’s session, such as time of day.

Date Mathematics JavaScript’s Math object is a built-in calculator. To perform math operations on information obtained from text fields, you first convert the values to numbers using the parseInt() or parseFloat() function. Date mathematics allows you to create countdown pages to important events.