-
Notifications
You must be signed in to change notification settings - Fork 0
/
quotes.html
43 lines (32 loc) · 1.22 KB
/
quotes.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<script>
const quotes = [
"The best way to predict the future is to invent it.",
"Do what you can, with what you have, where you are.",
"Life is 10% what happens to us and 90% how we react to it.",
"Success is not how high you have climbed, but how you make a positive difference to the world.",
"Your time is limited, so don’t waste it living someone else’s life.",
];
const colors = ["#f44336", "#9c27b0", "#3f51b5", "#4caf50", "#ff9800"];
const Element = document.getElementById("quote");
const btn = document.getElementById("Btn");
function generateQuote() {
const Quote = quotes[Math.floor(Math.random() * quotes.length)];
const Color = colors[Math.floor(Math.random() * colors.length)];
document.body.style.backgroundColor = Color;
}
btn.addEventListener("click", generateQuote);
document.body.addEventListener("mousemove", () => {
const Color = colors[Math.floor(Math.random() * colors.length)];
document.body.style.backgroundColor =Color;
});
</script>
<body>
</body>
</html>