forked from irfanshadikrishad/JavaScript101
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
24 lines (23 loc) · 778 Bytes
/
script.js
File metadata and controls
24 lines (23 loc) · 778 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
function eclickin(){
var copyText = document.getElementById("encodedtext");
copyText.select();
copyText.setSelectionRange(0, 99999);
navigator.clipboard.writeText(copyText.value);
}
function dclickin(){
var copyText = document.getElementById("decodedtext");
copyText.select();
copyText.setSelectionRange(0, 99999);
navigator.clipboard.writeText(copyText.value);
}
//encode-decode
function encode(){
let etext = document.getElementById('encodetext').value;
const encodedText = btoa(etext);
document.getElementById('encodedtext').value = encodedText;
}
function decode(){
let dtext = document.getElementById('decodetext').value;
const decodedText = atob(dtext);
document.getElementById('decodedtext').value = decodedText;
}