为啥 switch 语句不向应用返回信息? [关闭]
Posted
技术标签:
【中文标题】为啥 switch 语句不向应用返回信息? [关闭]【英文标题】:Why does the switch statement not return information to the app? [closed]为什么 switch 语句不向应用返回信息? [关闭] 【发布时间】:2022-01-19 01:40:57 【问题描述】:<!DOCTYPE html>
<html>
<head>
</head>
<body>
<input type="textArea" id="textSpot">
<button onclick="changeHtml()">Encode!!!</button>
<h2 id="afterEncode"></h2>
<script>
var textSpot = document.getElementById("textSpot").value
var letters = [text.charAt(0), text.charAt(1), text.charAt(2), text.charAt(3), text.charAt(4), text.charAt(5), text.charAt(6)]
var i = 0;
var code = "";
while (i < 10)
var code = ""
switch (letters[i])
case "a":
code += "\"
break;
case "b":
code += "^"
break;
case "c":
code += "ø"
break;
case "d":
code += "˜"
break;
case "e":
code += "ˣ"
break;
case "f":
code += "Ͱ"
break;
case "g":
code += "Є"
break;
case "h":
code += " г"
break;
case "i":
code += "д"
break;
case "j":
code += "ж"
break;
case "k":
code += "л"
break;
case "l":
code += "ѣ"
break;
case "m":
code += "Ѳ"
break;
case "n":
code += "҂"
break;
case "o":
code += "Ӷ"
break;
case "p":
code += "‡"
break;
case "q":
code += "⁊"
break;
case "r":
code += "※"
break;
case "s":
code += "⁀"
break;
case "t":
code += "‽"
break;
case "u":
code += "₌"
break;
case "v":
code += "₱"
break;
case "w":
code += "∏"
break;
case "x":
code += "≀"
break;
case "y":
code += "⌗"
break;
case "z":
code += "⌭"
break;
default:
console.error("> Unexpected Syntax Error _ (Code: 231815147381181320518)")
i++
function changeHtml()
document.getElementById("afterEncode").innerHTML = ("<h2>" + code + "</h2>")
</script>
</body>
</html>
我不认为这有什么问题,所以请有人帮助我。我正在使用 Chrome,这是最新的浏览器之一,所以我认为它必须是代码。我对代码不是很好,这是作为更大版本的测试版本构建的。
【问题讨论】:
【参考方案1】:我认为你应该在 var 字母中使用“textSpot”而不是“text”
【讨论】:
以上是关于为啥 switch 语句不向应用返回信息? [关闭]的主要内容,如果未能解决你的问题,请参考以下文章