Because you can't get the input value but you can have it like this.
function changeP() {
var foodname;
var input = document.getElementById("input").value;
if (input === "abc") {
foodname = "Hey Yo!";
} else if (input === "def") {
foodname = "!oY yeH";
} else {
foodname = "N/A";
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…