-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwonewrandom.html
61 lines (56 loc) · 1.62 KB
/
twonewrandom.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Random Quote Generator</title>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3mobile.css">
<style>
/* Add custom styles here */
#quote-container {
margin: 50px auto;
text-align: center;
}
#quote {
font-size: 24px;
font-weight: bold;
margin-bottom: 10px;
}
#author {
font-size: 20px;
}
button {
display: block;
margin: 0 auto;
}
</style>
</head>
<body class="w3-mobile">
<div class="w3-container w3-teal">
<h1>Random Quote Generator</h1>
</div>
<div class="w3-container" id="quote-container">
<p id="quote"></p>
<p id="author"></p>
</div>
<button class="w3-button w3-blue" onclick="displayRandomQuote()">Generate Random Quote</button>
<script>
// Here's the JavaScript code to display the quotes
const quotes = [
{
quote: "Beware; for I am fearless, and therefore powerful.",
author: "Mary Shelley, Frankenstein"
},
{
quote: "All the darkness in the world cannot extinguish the light of a single candle.",
author: "Saint Francis of Assisi"
},
// Add the other quotes here
];
function displayRandomQuote() {
const randomQuote = quotes[Math.floor(Math.random() * quotes.length)];
document.getElementById("quote").textContent = `"${randomQuote.quote}"`;
document.getElementById("author").textContent = `- ${randomQuote.author}`;
}
</script>
</body>
</html>