Nová ukázka
Reset
Načíst z URL
Uložit a získat odkaz
Vztahuje se k…
Nevyplňujte
Napiště „nejsem robot“
▶
Přepnout zobrazení
Výsledek
<textarea id="inp"></textarea> <br> <button id="ben" onclick="encrypt()">Zašifrovat</button> <br> <textarea id="enc"></textarea> <br> <button id="bde" onclick="decrypt()" disabled>Dešifrovat</button> <br> <textarea id="dec"></textarea>
HTML
Autoformát
Standardní režim
Mobilní zobrazení
CSS
Autoformát
CSS reset
Až na konci
function perform(input) { var array1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; var array2 = 'zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA'; var output = ''; for (var i = 0; i < input.length; i++) { var index = array1.indexOf(input[i]); output += index >= 0 ? array2[index] : input[i] } return output } function encrypt() { var inp = document.getElementById('inp'), enc = document.getElementById('enc'), bde = document.getElementById('bde'); enc.value = perform(inp.value); bde.disabled = false } function decrypt() { var enc = document.getElementById('enc'), dec = document.getElementById('dec'); dec.value = perform(enc.value); }
J
ava
S
cript
Autoformát
jQuery
Umístění JS
window.onload
</head>
</body>