<input type="text" id="text">
<span id="result"></span>
window.onload = function(){
document.querySelector("#text").addEventListener("input",function(){
var res = "";
switch(this.value){
case "777":res = "Яблоки";break;
//case "value":res = "result";break;.
//case "value":res = "result";break;
//....
}
document.querySelector("#result").innerHTML = res;
});
}