-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6d.html
More file actions
41 lines (40 loc) · 1.02 KB
/
Copy path6d.html
File metadata and controls
41 lines (40 loc) · 1.02 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Voter Information</title>
<style>
table {
border-collapse: collapse;
}
th, td {
border: 1px solid black;
padding: 10px;
}
</style>
</head>
<body>
<h2>Voter Information</h2>
<button onclick="getVoterInfo()">Get Voter Info</button>
<div id="voterInfo"></div>
<script>
function getVoterInfo() {
let name = prompt("Please enter your name:");
let age = parseInt(prompt("Please enter your age:"));
let votingEligibility = (age >= 18) ? "Eligible" : "Not Eligible";
let voterInfoHtml = `
<table>
<tr>
<th>Name</th>
<th>Age</th>
<th>Voting Eligibility</th>
</tr>
<tr>
<td>${name}</td>
<td>${age}</td>
<td>${votingEligibility}</td>
</tr>
</table>
`; document.getElementById("voterInfo").innerHTML =
voterInfoHtml;
}
</script> </body> </html>