- Konu Yazar
- #1
HTML:
<!DOCTYPE html>
<html>
<body>
<h2>Base64 Encode/Decode</h2>
<form>
Metin:<br>
<textarea id="textInput" rows="4" cols="50"></textarea>
<br><br>
<input type="button" value="Encode" onclick="encodeText()">
<input type="button" value="Decode" onclick="decodeText()">
</form>
<br>
<p>Sonuç: <span id="result"></span></p>
<script>
function encodeText() {
const textInput = document.getElementById("textInput").value;
const encodedText = btoa(textInput);
document.getElementById("result").innerHTML = encodedText;
}
function decodeText() {
const textInput = document.getElementById("textInput").value;
const decodedText = atob(textInput);
document.getElementById("result").innerHTML = decodedText;
}
</script>
</body>
</html>