Skip to content

Commit 2fc123a

Browse files
committed
Created Timer Files
HTML, CSS & JS
1 parent 6596ef3 commit 2fc123a

5 files changed

Lines changed: 158 additions & 0 deletions

File tree

projects/timeout.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This is for example only
2+
3+
// function cera() {
4+
// setTimeout(setAlert, 4000); //4 seconds
5+
// }
6+
// function setAlert() {
7+
// alert("Hello World!");
8+
// }
9+
10+
// function decrease() {
11+
// let i;
12+
// let num = 0;
13+
// for (i=10; i>num; i--) {
14+
// tens.textContent = i
15+
// // console.log("Done!!")
16+
// }
17+
// console.log(tens)
18+
// }

projects/timer.css

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
}
5+
6+
body {
7+
text-align: center;
8+
padding: 10px;
9+
font-size: 30px;
10+
}
11+
.container {
12+
max-width: 100%;
13+
margin: 10 auto;
14+
/* border: 3px solid red; */
15+
padding: 20px;
16+
}
17+
18+
.heading {
19+
color: blue;
20+
padding: 10px;
21+
}
22+
23+
span {
24+
padding: 10px;
25+
margin: 10px 5px;
26+
}
27+
button {
28+
display: inline-block;
29+
outline: 0;
30+
cursor: pointer;
31+
text-align: center;
32+
border: 0;
33+
padding: 7px 16px;
34+
min-height: 36px;
35+
min-width: 36px;
36+
color: #ffffff;
37+
background: #008060;
38+
border-radius: 4px;
39+
font-weight: 500;
40+
font-size: 14px;
41+
box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 0px 0px, rgba(0, 0, 0, 0.2) 0px -1px 0px 0px inset;
42+
}
43+
44+
button:hover {
45+
background: #006e52;
46+
}

projects/timer.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" href="timer.css">
8+
<title>Timer</title>
9+
</head>
10+
<body>
11+
<div class="container">
12+
<div class="heading">
13+
<h1>Timer</h1>
14+
</div>
15+
<div class="timer-clock">
16+
<span id="seconds">00</span>:<span id="tens">00</span>
17+
<div class="buttons">
18+
<button class="btn" onclick="start()">Start</button>
19+
<button class="btn" onclick="decree()">Stop</button>
20+
<script src="timeout.js"></script>
21+
<button class="btn">Reset</button>
22+
</div>
23+
<script src="timer.js"></script>
24+
<script src="timeout.js"></script>
25+
</div>
26+
</div>
27+
</body>
28+
</html>

projects/timer.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
const seconds = document.getElementById("seconds");
2+
const tens = document.getElementById("tens");
3+
4+
console.log(seconds);
5+
console.log(tens);
6+
7+
/*
8+
? What I have to do ?
9+
TODO : onclick of start button, it should start from 60 to 0, means it will decrease every one second,
10+
* Need three buttons start, stop & reset
11+
* first make simple for 10s to decrease to 0
12+
! Time should decrease every second,
13+
*/
14+
15+
16+
function decrease_10() {
17+
let i = 10;
18+
for (i; i<50; i++) {
19+
tens.textContent = i
20+
console.log(tens)
21+
// console.log("Done!!")
22+
}
23+
24+
}
25+
26+
function start() {
27+
// let i
28+
// time_in = 10
29+
// for (i=time_in; i<10; i--){
30+
// console.log(i)
31+
// // tens.textContent = i
32+
// }
33+
// console.log("Start")
34+
setInterval(decrease,1000)
35+
// let i
36+
// for (i=0; i<4; i++){
37+
// tens.textContent = i
38+
// }
39+
// console.log(tens)
40+
tens.textContent = i
41+
}
42+
43+
/*
44+
! function reduce() {
45+
46+
// // alert("Shown!!")
47+
} */
48+
49+
function decrease() {
50+
console.log(tens)
51+
// alert("done!!")
52+
// let i;
53+
// let num = 0;
54+
// for (i=10; i>num; i--) {
55+
// tens.textContent = i
56+
// // console.log("Done!!")
57+
// }
58+
// console.log(tens)
59+
}
60+

projects/try.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const prompt = require("prompt-sync")();
2+
3+
var name = prompt("What's your name");
4+
console.log("hello" + name + "!");
5+
6+
// It worked 👍

0 commit comments

Comments
 (0)