jda_m06/uf01/examen_jan_maroto/exercici_01.html
2022-02-16 16:13:08 +01:00

29 lines
696 B
HTML
Executable file

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Problema primer encriptació</title>
</head>
<body>
<p id="ex01"></p>
<script>
var str = prompt("Input the encoded string");
var modChar = prompt("Input the character to decode the string");
// Decoded string
var decStr="";
for (var i=0; i<str.length; i++) {
if (str[i]==modChar) {
decStr+=str[i+1];
}
}
document.getElementById("ex01").innerHTML = decStr;
</script>
</body>
</html>