0% found this document useful (0 votes)
54 views2 pages

Clock Code

This document is an HTML file that creates a dynamic clock displayed on a webpage. It uses JavaScript to update the clock every second, showing the current seconds, hours, and minutes in a specific format. The styling is set to have a black background with white text, using a monospace font for clarity.

Uploaded by

florift.com
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views2 pages

Clock Code

This document is an HTML file that creates a dynamic clock displayed on a webpage. It uses JavaScript to update the clock every second, showing the current seconds, hours, and minutes in a specific format. The styling is set to have a black background with white text, using a monospace font for clarity.

Uploaded by

florift.com
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

<!

DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dynamic Clock</title>
<style>
body {
font-family: monospace;
text-align: left;
white-space: pre;
background-color: black;
color: white;
font-size: 20px;
}
#clock {
line-height: 1.2;
}
</style>
</head>
<body>

<pre id="clock"></pre>

<script>
function updateClock() {
let now = new Date();
let hours = [Link]();
let minutes = [Link]();
let seconds = [Link]();

let clockDisplay = "";

// Seconds (Vertical)
for (let i = 0; i < seconds; i++) {
clockDisplay += ` ${seconds}\n`;
}

// Hours (Left-aligned)
for (let i = 0; i < hours; i++) {
clockDisplay += `10 ${seconds}\n`;
}

// Minutes (Right-aligned)
clockDisplay += `10 ${seconds} `;
for (let i = 0; i < minutes; i++) {
clockDisplay += "14 ";
}
// Update the clock display
[Link]("clock").textContent = clockDisplay;

setTimeout(updateClock, 1000); // Refresh every second


}

// Start the clock


updateClock();
</script>

</body>
</html>

You might also like