From 2057d7b23a26cfb6b4333a1f23455026563471ec Mon Sep 17 00:00:00 2001 From: mrdog233o5 Date: Tue, 9 Apr 2024 16:13:41 +0800 Subject: fixed the shit --- main.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/main.js b/main.js index 7c1e830..42895b4 100644 --- a/main.js +++ b/main.js @@ -90,7 +90,7 @@ MÂ <¯ >˘ ?¿`.split("\n"); -const modeBtn = document.getElementById("modeBtn"); +const modeBtn = document.getElementById("mode"); const convertBtn = document.getElementById("convertBtn"); const input = document.getElementById("input"); const output = document.getElementById("output"); @@ -120,16 +120,8 @@ function convert(input, mode) { return result; } -modeBtn.addEventListener("click", () => { - mode = !mode; - if (mode) { - modeBtn.innerText = "normal text > encrypted text"; - } else { - modeBtn.innerText = "encrypted text > normal text"; - } -}); - convertBtn.addEventListener("click", () => { + mode = modeBtn.value == "0" ? true : false; var res = convert(input.value, mode); output.innerText = res; }); -- cgit v1.2.3