Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

javascript (.js) and html file seperate Javascript: use strict; var $ = function(id) { return document.getElementById(id); }; var displayCurrentTime = function() { }; var padSingleDigit

javascript (.js) and html file seperate image text in transcribed

Javascript:

"use strict";

var $ = function(id) { return document.getElementById(id); };

var displayCurrentTime = function() {

};

var padSingleDigit = function(num) {

if (num

else { return num; }

}; window.onload = function() {

// set initial clock display and then set interval timer to display

// new time every second. Don't store timer object because it

// won't be needed - clock will just run.

};

HTML:

Clock

Digital clock

Clock

:

:

Extra 7-1 Develop the Clock application In this exercise, you'll create an application that displays the current time in hours, minutes, and seconds. The display should use a 12-hour clock and indicate whether it's AM or PM. The application looks like this Digital clock Clock : 21: 43 PM To convert the computer's time from a 24-hour clock to a 12-hour clock, first check to see if the hours value is greater than 12. If so, subtract 12 from the hours value and set the AMPM value to "PM". Also, be aware that the hours value for midnight is 0 1. Open the HTML and JavaScript files in this foldei exercises extra\ch07\clockl 2. In the JavaScript file, note that four functions are supplied. The function. The start of a displayCurrentTime) function. The padSingleDigit) function that adds a leading zero to single digits. And the start of an onload event handler 3. In the displayCurrentTime) function, add code that uses the Date object to determine the current hour, minute, and second. Convert these values to a 12 hour clock, determine the AM/PM value, and display these values in the appropriate span tags In the onload event handler, code a timer that calls the displayCurrentTime0 function at 1 second intervals. Also, make sure that the current time shows as soon as the page loads 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

1. Television more Over watching faceing of many problems ?

Answered: 1 week ago

Question

Is there a link between chronic stress and memory function?

Answered: 1 week ago

Question

Were all members comfortable brainstorming in front of each other?

Answered: 1 week ago

Question

4. What will the team agreement contain?

Answered: 1 week ago