-
Notifications
You must be signed in to change notification settings - Fork 22
/
index.html
145 lines (137 loc) · 3.13 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>Size Table Example</title>
<style>
.container {
display: flex;
}
.input-section {
flex: 1;
padding-right: 20px;
}
.output-section {
flex: 1;
}
.size-table {
border-collapse: collapse;
width: 100%;
}
.size-table th, .size-table td {
border: 1px solid black;
padding: 8px;
text-align: center;
}
.size-table th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<div class="container">
<div class="input-section">
<div>
<label for="json-input">JSON 데이터 입력:</label><br>
<textarea id="json-input" rows="5" cols="50"></textarea>
<button onclick="generateTable()">테이블 생성</button>
</div>
<p>예시 데이터:</p>
<pre>
{
"S": {
"총장": "46.4",
"허리(포켓 달리는 위치)": "36.5",
"엉덩이": "43.5"
},
"M": {
"총장": "48.4",
"허리(포켓 달리는 위치)": "38.6",
"엉덩이": "45.5"
}
}
</pre>
<button onclick="applyExample(0)">Apply</button>
<pre>
{
"XS/S": {
"총기장": "81.5",
"어깨너비": "39",
"가슴너비": "39",
"허리": "33",
"힙너비": "43.5",
"소매기장": "44.5"
},
"S/M": {
"총기장": "83",
"어깨너비": "41",
"가슴너비": "39",
"허리": "35",
"힙너비": "45.5",
"소매기장": "44.5"
}
}
</pre>
<button onclick="applyExample(1)">Apply</button>
</div>
<div class="output-section">
<h3>결과:</h3>
<div id="table-container"></div>
</div>
</div>
<script src="bundle.js"></script>
<script>
const examples = [
`{
"S": {
"총장": "46.4",
"허리(포켓 달리는 위치)": "36.5",
"엉덩이": "43.5"
},
"M": {
"총장": "48.4",
"허리(포켓 달리는 위치)": "38.6",
"엉덩이": "45.5"
}
}`,
`{
"XS/S": {
"총기장": "81.5",
"어깨너비": "39",
"가슴너비": "39",
"허리": "33",
"힙너비": "43.5",
"소매기장": "44.5"
},
"S/M": {
"총기장": "83",
"어깨너비": "41",
"가슴너비": "39",
"허리": "35",
"힙너비": "45.5",
"소매기장": "44.5"
}
}`
];
function applyExample(index) {
document.getElementById('json-input').value = examples[index];
}
function generateTable() {
const jsonInput = document.getElementById('json-input').value;
if (jsonInput.trim() === '') {
alert('JSON 데이터를 입력해주세요.');
return;
}
try {
const data = JSON.parse(jsonInput);
const table = getSizeTable(data);
if (table !== '') {
document.getElementById('table-container').innerHTML = table;
}
} catch (error) {
alert('유효한 JSON 형식이 아닙니다.');
}
}
</script>
</body>
</html>