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

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.
HTML Comprehensive Concepts and Techniques Second Edition Project 8 Integrating JavaScript with HTML.
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.
Using Object-Oriented JavaScript CST 200- JavaScript 4 –
 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.
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.
Database-Driven Web Sites, Second Edition1 Chapter 3 INTRODUCTION TO CLIENT-SIDE SCRIPTS.
1 CLIENT-SIDE SCRIPTS. Objectives 2 Learn how to reference objects in HTML documents using the HTML DOM and dot syntax Learn how to create client-side.
Chapter 10 Creating Pop-Up Windows, Adding Scrolling Messages, and Validating Forms HTML5 & CSS 7 th Edition.
The Web Wizard’s Guide To JavaScript Chapter 6 Working with Dates and Times.
Integrating JavaScript and HTML5 HTML5 & CSS 7 th Edition.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
1 JavaScript 1. 2 Java vs. JavaScript Java –Is a high level programming language –Is platform independent –Runs on a standardized virtual machine.
Adobe GoLive Edit and FTP your web pages to a web server.
 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.
Variables and Inheritance Part 1
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
1 JavaScript
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.
CIS 375—Web App Dev II JavaScript I. 2 Introduction to DTD JavaScript is a scripting language developed by ________. A scripting language is a lightweight.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
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.
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.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
Java Script Programming. Review: Event Handling Text Box Title: Button.
Chapter 9. An event-driven, object-based programming language that provides various types of functionality to pages. Object based: it is a language that.
The Web Wizard’s Guide To DHTML and CSS Chapter 2 A Review of CSS2 and JavaScript.
 2001 Prentice Hall, Inc. All rights reserved. Outline 1 JavaScript.
Chapter 6 JavaScript: Introduction to Scripting
© 2015, Mike Murach & Associates, Inc.
Introduction to Scripting
Introduction to JavaScript
JavaScript.
Chapter 7 - JavaScript: Introduction to Scripting
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
JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
Chapter 7 - JavaScript: Introduction to Scripting
The Web Wizard’s Guide To JavaScript
Basic program gives only one quess and then the program ends.
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.