-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
93 lines (91 loc) · 2.72 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>U(。・∀・)ノ゙</title>
<!-- 参考地址:https://segmentfault.com/a/1190000017190802 -->
<link rel="stylesheet" href="./alphabet.css" />
<style>
.row {
display: flex;
}
.block {
margin: 5px;
width: 25px;
height: 25px;
position: relative;
}
.block::before {
content: '';
/* 一个点的大小(例:20px x 20px) */
width: 5px;
height: 5px;
/* box-shadow 着色,伪元素设为透明 */
background-color: transparent;
/* 调整伪元素位置,让左上角成为(0,0) */
position: absolute;
top: -5px;
left: -5px;
}
.row > .block {
flex-wrap: wrap;
}
#print_container {
height: 200px;
}
</style>
</head>
<body>
<div id="print_container">
<textarea id="content" rows="10" cols="50"></textarea>
<button id="btn_translate">go</button>
</div>
<div id="container">
<!-- <div class="row">
<div class="block A"></div>
<div class="block B"></div>
<div class="block C"></div>
<div class="block D"></div>
<div class="block E"></div>
<div class="block F"></div>
<div class="block G"></div>
<div class="block H"></div>
<div class="block I"></div>
<div class="block J"></div>
<div class="block K"></div>
<div class="block L"></div>
<div class="block M"></div>
<div class="block N"></div>
<div class="block O"></div>
<div class="block P"></div>
<div class="block Q"></div>
<div class="block R"></div>
<div class="block S"></div>
<div class="block T"></div>
<div class="block U"></div>
<div class="block V"></div>
<div class="block W"></div>
<div class="block X"></div>
<div class="block Y"></div>
<div class="block Z"></div>
</div> -->
</div>
</body>
<script>
document.getElementById('btn_translate').onclick = function translate() {
let content = document.getElementById('content').value.toUpperCase();
document.getElementById('container').innerHTML = '';
let html = '';
content.split('\n').forEach((str) => {
html += '<div class="row">';
str.split('').forEach((ele) => {
html += `<div class="block ${ele}"></div>`;
});
html += '</div>';
});
document.getElementById('container').innerHTML = html;
};
</script>
</html>