-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
55 lines (51 loc) · 1.39 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Generate</title>
<style>
body {
font-family: sans-serif;
margin: 0;
padding: 0;
background-color: #f0f0f0;
}
h1 {
text-align: center;
margin-top: 20px;
font-size: 24px;
}
button {
display: block;
margin: 20px auto;
padding: 10px 20px;
background-color: #007bff;
color: #fff;
border: none;
cursor: pointer;
}
#result {
text-align: center;
font-size: 20px;
margin-top: 20px;
}
</style>
</head>
<body>
<h1>Random Generate</h1>
<button onclick="generateRandomCharacter()">Generate</button>
<p id="result"></p>
<script>
function generateRandomCharacter() {
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
var result = "";
for (var i = 0; i < 7; i++) {
var randomIndex = Math.floor(Math.random() * chars.length);
result += chars.charAt(randomIndex);
}
document.getElementById("result").innerHTML = result;
}
</script>
</body>
</html>