-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
28 lines (22 loc) · 1.06 KB
/
script.js
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
function encriptar () {
var texto = document.querySelector("#input-texto").value;
var textoCifrado = texto.replace (/e/gi, "enter").replace(/i/gi, "imes").replace(/a/gi, "ai").replace(/o/gi, "ober").replace(/u/gi, "ufat");
document.querySelector(".text-input-salida").value = textoCifrado;
document.querySelector("#input-texto").value;
}
var boton1 = document.querySelector("#boton-encriptar"); boton1.onclick = encriptar;
function desencriptar(){
var texto = document.querySelector("#input-texto").value;
var textoCifrado = texto.replace(/enter/gi, "e").replace(/imes/gi, "i").replace(/ai/gi, "a").replace(/ober/gi, "o").replace(/ufat/gi, "u");
document.querySelector(".text-input-salida").value = textoCifrado;
document.querySelector("#input-texto").value;
}
var boton2 = document.querySelector("#boton-desencriptar"); boton2.onclick = desencriptar;
{
function copy() {
let copyText = document.querySelector("#mensaje");
copyText.select();
document.execCommand("copy");
}
document.querySelector("#copy").addEventListener("click", copy);
}