-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
60 lines (45 loc) · 1.36 KB
/
index.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
58
59
60
function renderTime(){
let myDate= new Date();
let year= myDate.getYear();
if(year<1000){
year+= 1900
}
let day= myDate.getDay();
let month= myDate.getMonth();
let days= myDate.getDate();
let dayarr= new Array("Sunday,","Monday,","Tuesday,","Wednesday,","Thrusday,","Friday,","Saturday,");
let montharr= new Array("January","February","March","April","May","June","July","August","September","October","November","December");
let currentTime= new Date();
let h= currentTime.getHours();
let m= currentTime.getMinutes();
let s= currentTime.getSeconds();
if(h === 24){
h = 0;
} else if(h > 12){
h= h-0;
}
if(h<10){
h= "0" + h;
}
if(m<10){
m= "0" + m;
}
if(s<10){
s= "0" + s;
}
let myClock= document.getElementById("clockDisplay");
myClock.textContent= "" +dayarr[day]+ " " +days+ " " +montharr[month]+ " " +year+ " | " +h+ ":" +m+ ":" +s;
myClock.innerText= "" +dayarr[day]+ " " +days+ " " +montharr[month]+ " " +year+ " | " +h+ ":" +m+ ":" +s;
setTimeout("renderTime()", 1000);
}
renderTime();
let y=document.querySelector("#email");
document.querySelector("#btn").addEventListener("click",subscribe);
function subscribe(){
let y=document.querySelector("#email").value;
if(y==""){
alert("enter email")}
else{
alert("subscribed succesfully")
}
}