-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbase64text.html
More file actions
41 lines (31 loc) · 758 Bytes
/
base64text.html
File metadata and controls
41 lines (31 loc) · 758 Bytes
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<style>
#btnDeConv{display:none;}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea rows=6 cols=15 autofocus></textarea><br>
<button id="btnConv">Convert</button>
<button id="btnDeConv">DeConvert</button>
<script>
str = "asd";
$('textarea').val(str);
$('#btnConv').click(function(){
var txt = $('textarea').val();
var b64 = btoa(unescape(encodeURIComponent(txt)));
$('textarea').val(b64);
$('#btnDeConv').show();
});
$('#btnDeConv').click(function(){
var b64 = $('textarea').val();
var txt = decodeURIComponent(escape(window.atob(b64)));
$('textarea').val(txt);
});
</script>
</body>
</html>