-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage_ass.html
101 lines (90 loc) · 2.84 KB
/
storage_ass.html
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> COUNTER MONITOR WITH LOCAL STORAGE</title>
<style type="text/css">
body{background-color: #f4f9fe;}
button{
width: 150px;
height: 30px;
line-height: 30px;
border:0;
border-radius: 30px;
background-color:#0c5eb5;
color: white;
box-shadow: 0 0 10px 0 rgba(0,0,0,0.4);
margin-top: 10px;}
h3{color: #0c5eb5;}
</style>
</head>
<body onunload="storecount()" onload="loadcount()">
<center>
<h3>COUNT MONITOR WITH LOCAL STORAGE</h3>
<div id="dem"></div><br>
<div id="dm"></div><br>
<button onclick="counter1()" style="width: 100px">COUNT</button><br><br>
<div id="demo"></div> <br>
</center>
<script type="text/javascript">
var counte= 0;
var dat= new Date();
var n = dat.getMinutes();
var addon=n+1;
function plus(){
var dat= new Date();
n = dat.getMinutes();
x = dat.getSeconds();
if(n===addon){
counte=0;
addon++; }
dem.innerHTML="The time is " + n +" : "+x;
demo.innerHTML= " Count will drop back to 0 when the Minute changes to " +addon ;}
function counter1(){
counte++;
dm.innerHTML= "You have pressed me "+ counte +" time(s) in the last ONE Minute";}
intval= setInterval(plus, 1000);
</script>
<hr> <br>
<!-- Beginning of everyday's counter-->
<center>
<div id="show3"></div><br>
<div id="show"></div><br>
<button onclick="counter()" style="width: 100px">COUNT</button> <br><br>
<div id="show2"></div><br>
</center>
<script type="text/javascript">
var count2=0;
var counts=0;
var m= new Date();
var y = m.getDate();
var x = m.getMinutes();
var f= m.getHours();
var z =m.getSeconds();
var addone=y+1;
function storecount(){localStorage.setItem("store", counts );
localStorage.setItem("store2", count2);
localStorage.setItem("storec", counte);}
function loadcount(){counts= localStorage.getItem("store");
count2= localStorage.getItem("store2");
counte= localStorage.getItem("storec");}
function plusplus(){
var m= new Date();
y = m.getDate();
w = m.getHours();
x = m.getMinutes();
z =m.getSeconds();
if(y===addone){
count2=0;
addone++; }
show3.innerHTML= "The Date is "+y+" and the time is "+f+" : " + x +" : " + z + " and today's date is " + y + ". Let's see what will happen tomorrow"}
timex=setInterval(plusplus, 1000)
function counter(){
counts++;
count2++;
show.innerHTML= "You've pressed me "+counts+" time(s) in your life time";
show2.innerHTML= "You've pressed me "+count2+" time(s) today as well but note that I will automatically return to zero(0) tomorrow "+ addone + " and you will have to start all over by pressing me again. <br> Therefore,HAPPY PRESSING!!!!!!!!!"; }
</script>
</body>
</html>