This repository was archived by the owner on Dec 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOnline_voting01.html
73 lines (60 loc) · 1.66 KB
/
Online_voting01.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
h1,
h2 {
text-align: center;
}
.voting-options {
display: flex;
justify-content: center;
}
.vote-button {
margin: 10px;
padding: 10px;
font-size: 16px;
cursor: pointer;
}
#result {
margin-top: 20px;
}
</style>
<script>
// Simple JavaScript to handle voting and display results
let votes = {
option1: 0,
option2: 0,
option3: 0
};
function vote(option) {
votes[option]++;
displayResults();
}
function displayResults() {
const resultElement = document.getElementById('result');
resultElement.innerHTML = `
<h2>Results</h2>
<p>Option 1: ${votes.option1} votes</p>
<p>Option 2: ${votes.option2} votes</p>
<p>Option 3: ${votes.option3} votes</p>
`;
}
</script>
</head>
<body>
<h1>Vote for Your Favorite Option</h1>
<div class="voting-options">
<button class="vote-button" onclick="vote('option1')">Option 1</button>
<button class="vote-button" onclick="vote('option2')">Option 2</button>
<button class="vote-button" onclick="vote('option3')">Option 3</button>
</div>
<div id="result"></div>
</body>
</html>