Javascript - Base64 Encode/Decode
by 1004lucifer
HTML
<div style="height:300px">
<input type="text" id="text1" /><br />
<button id="encoding">인코딩</button>
<button id="decoding">디코딩</button><br />
결과: <span id="result"></span>
</div>
JavaScript
$('#encoding').click(function() {
$('#result').html(
window.btoa(
encodeURIComponent(
$('#text1').val()
)
)
)
})
$('#decoding').click(function() {
$('#result').html(
decodeURIComponent(
window.atob(
$('#text1').val()
)
)
)
})