144 lines
3.3 KiB
HTML
144 lines
3.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>格式转换</title>
|
|
<style>
|
|
body {
|
|
text-align: center;
|
|
margin-top: 100px;
|
|
}
|
|
.io {
|
|
width: 80%;
|
|
display: inline-block;
|
|
height : 5rem
|
|
}
|
|
.turn {
|
|
margin: 2rem;
|
|
}
|
|
|
|
|
|
button-group {
|
|
display: inline-block;
|
|
margin: 0 0.5rem;
|
|
/*width: 1rem;*/
|
|
}
|
|
|
|
button-group button {
|
|
display: block;
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<h3>输入</h3>
|
|
<textarea id="in" class="io"></textarea>
|
|
|
|
<div class="turn">
|
|
|
|
<button-group>
|
|
<button id="turnio" style="margin-right: 5rem; ">交换输入输出</button>
|
|
<button id="clearo" style="margin-right: 5rem; "> 清空输出 </button>
|
|
<button id="clear" style="margin-right: 5rem; "> 清空所有 </button>
|
|
</button-group>
|
|
|
|
<button-group>
|
|
<button id="utf8Tobase64">UTF8 转 base64</button>
|
|
<br>
|
|
<button id="base64ToUtf8">base64 转 UTF8</button>
|
|
</button-group>
|
|
|
|
|
|
<button-group>
|
|
<button id="base64ToHex">base64 转 Hex</button>
|
|
<br>
|
|
<button id="hexToBase64">Hex 转 base64</button>
|
|
</button-group>
|
|
|
|
|
|
<button-group>
|
|
<button id="utf8ToHex">UTF8 转 Hex</button>
|
|
<br>
|
|
<button id="hexToUtf8">Hex 转 UTF8</button>
|
|
</button-group>
|
|
|
|
</div>
|
|
|
|
|
|
<h3>输出</h3>
|
|
<textarea id="out" class="io"></textarea>
|
|
|
|
<!--<script type="application/javascript" src="base64.js"></script>-->
|
|
<script type="application/javascript" src="tool.js"></script>
|
|
<script type="text/javascript" src="./jquery.min.js"></script>
|
|
<script type="application/javascript">
|
|
$(function () {
|
|
$("#turnio").click(function () {
|
|
var inText = $("#in").val();
|
|
var outText = $("#out").val();
|
|
|
|
$("#in").val( outText );
|
|
$("#out").val( inText );
|
|
})
|
|
|
|
$("#cleari").click(function () {
|
|
$("#in").val("");
|
|
})
|
|
|
|
$("#clearo").click(function () {
|
|
$("#out").val("");
|
|
})
|
|
|
|
$("#clear").click(function () {
|
|
$("#in").val("");
|
|
$("#out").val("");
|
|
})
|
|
|
|
$("#utf8Tobase64").click(function () {
|
|
var inText = $("#in").val();
|
|
var out = utf8ToBase64( inText );
|
|
$("#out").val( out );
|
|
})
|
|
|
|
|
|
$("#base64ToUtf8").click(function () {
|
|
var inText = $("#in").val();
|
|
var out = base64ToUtf8(inText)
|
|
$("#out").val( out );
|
|
})
|
|
|
|
$("#base64ToHex").click(function () {
|
|
var inText = $("#in").val();
|
|
var out = base64ToHex(inText)
|
|
$("#out").val( out );
|
|
})
|
|
|
|
$("#hexToBase64").click(function () {
|
|
var inText = $("#in").val();
|
|
var out = hexToBase64( inText )
|
|
$("#out").val( out );
|
|
})
|
|
|
|
|
|
$("#hexToUtf8").click(function () {
|
|
var inText = $("#in").val();
|
|
out = hexToUtf8(inText)
|
|
$("#out").val( out );
|
|
})
|
|
|
|
|
|
$("#utf8ToHex").click(function () {
|
|
var inText = $("#in").val();
|
|
out = utf8ToHex( inText )
|
|
$("#out").val( out );
|
|
})
|
|
|
|
})
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|