forked from KDHarsh24/VisitManipur
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
57 lines (51 loc) · 1.76 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
49
50
51
52
53
54
55
56
57
const doctags = document.getElementsByClassName("imagegot");
const imageList = ["./1.jpg", "./2.jpg", "./3.jpg", "./4.jpg", "./5.jpg", "./6.jpg", "./7.jpg", "./8.jpg", "./9.jpg"];
const changeImage = (event) => {
let imageData = event.target.id;
const clickImage = document.getElementById("imagetag");
if(imageData === "Loktak")
clickImage.src = "./1.jpg";
else if (imageData === "Kangla")
clickImage.src = "./2.jpg";
else if (imageData === "Ima")
clickImage.src = "./3.jpg";
else if (imageData === "Iskon")
clickImage.src = "./4.jpg";
else if (imageData === "Mao")
clickImage.src = "./5.jpg";
else if (imageData === "Museum")
clickImage.src = "./6.jpg";
else if (imageData === "War")
clickImage.src = "./7.jpg";
else if (imageData === "Deer")
clickImage.src = "./8.jpg";
else if (imageData === "Dzoku")
clickImage.src = "./9.jpg";
}
for (let i = 0; i < doctags.length; i++) {
const element = doctags[i];
element.addEventListener("mouseenter", changeImage);
}
var index = 0;
setInterval (function(){
if (index === imageList.length) {
index = 0;
}
document.getElementById("imagetag").src = imageList[index];
index++;
} , 3000);
function startTime() {
const today = new Date();
let hours = today.getHours();
let minutes = today.getMinutes();
// Check whether AM or PM
let newformat = hours >= 12 ? 'PM' : 'AM';
// Find current hour in AM-PM Format
hours = hours % 12;
// To display "0" as "12"
hours = hours ? hours : 12;
minutes = minutes < 10 ? '0' + minutes : minutes;
document.getElementById('clock').innerHTML = hours + ":" + minutes + newformat;
setTimeout(startTime, 1000);
}
document.body.onload = startTime()