Created
June 3, 2021 05:41
-
-
Save code08-ind/2b82ec91575fb04946b69016c479672a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let container = document.createElement('div'); | |
document.body.appendChild(container); | |
let head = document.createElement("h2"); | |
container.appendChild(head); | |
let date; | |
function callDate() { | |
setInterval(() => { | |
date = new Date(); | |
let finalDate = date.toLocaleTimeString(); | |
head.innerText = finalDate; | |
}, 1000); | |
} | |
function createClock(className, display, flexDirection, alignItems, justifyContent, width, margin, backgroundColor, border, borderRadius, childPadding, childColor) { | |
container.className = className; | |
container.style.display = display; | |
container.style.flexDirection = flexDirection; | |
container.style.alignItems = alignItems; | |
container.style.justifyContent = justifyContent; | |
container.style.width = width; | |
container.style.margin = margin; | |
container.style.backgroundColor = backgroundColor; | |
container.style.border = border; | |
container.style.borderRadius = borderRadius; | |
head.style.padding = childPadding; | |
head.style.color = childColor; | |
callDate(); | |
} | |
createClock("container", "flex", "row", "center", "center", "18%", "100px auto", "white", "3px solid blue", "30px", "30px 40px", "cyan"); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment