-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
48 lines (39 loc) · 1.57 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Practice Problem Smartwatch
console.clear;
var watchSkin = document.getElementById("timer");
var redSkinBtn = document.getElementById("color-red");
var blueSkinBtn = document.getElementById("color-blue");
var pinkSkinBtn = document.getElementById("color-pink");
var blackSkinBtn = document.getElementById("color-black");
var purpleSkinBtn = document.getElementById("color-purple");
var time3 = document.getElementById("second");
var pulse = document.getElementById("pulse");
var timeBtn = document.getElementById("time-piece");
var pulseBtn = document.getElementById("heart-rate");
redSkinBtn.addEventListener("click", function () {
watchSkin.style.backgroundImage = 'url("red-watch-skin.png")';
});
blueSkinBtn.addEventListener("click", function () {
watchSkin.style.backgroundImage = 'url("blue-watch-skin.png")';
});
pinkSkinBtn.addEventListener("click", function () {
watchSkin.style.backgroundImage = 'url("pink-watch-skin.png")';
});
blackSkinBtn.addEventListener("click", function () {
watchSkin.style.backgroundImage = 'url("black-watch-skin.png")';
});
purpleSkinBtn.addEventListener("click", function () {
watchSkin.style.backgroundImage = 'url("purple-watch-skin.png")';
});
timeBtn.addEventListener("click", function () {
time3.classList.remove("hidden");
pulse.style.display = "none";
});
pulseBtn.addEventListener("click", function () {
time3.classList.add("hidden");
pulse.style.display = "block";
});
setInterval(function () {
const date = new Date();
time3.innerHTML = date.toLocaleTimeString();
}, 1000);