-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdecode.html
35 lines (34 loc) · 853 Bytes
/
decode.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Decode Unicode</title>
<style>
textarea {
width: 45vw;
height: 90vh;
}
</style>
</head>
<body>
<textarea name="" id="input" cols="30" rows="10"></textarea>
<textarea name="" id="output" cols="30" rows="10"></textarea>
<div>
<button id="decode">转码</button>
</div>
<script>
var input = document.getElementById('input');
var output = document.getElementById('output');
var decode = document.getElementById('decode');
decode.onclick = function() {
try {
var value = input.value;
output.value = JSON.stringify(JSON.parse(value), null, 2);
} catch(err) {
alert(err.message);
}
}
</script>
</body>
</html>