JAVASCRIPT 做出一個輸入員編
然後顯示名字的Promt
輸入A01顯示Sandy
var USERINPUT01 =prompt(“輸入員編”)
var USERINPUT = USERINPUT01.toUpperCase()
var information = { “A01″ :”Sandy”, “A02″ :”Ammy”, “A03″ :”Jhon”, “A04″ :”Mini”, “A05″ :”Ben”, “A06″ :”Susan”, “A07″ :”Jhony”, “A08″ :”Kenny”,};
var input_in_information = false;
for (var key in information){
if (key == USERINPUT){
input_in_information = true;
break; }}
//検索終わり アラート
if(input_in_information)
{ alert(information[key]) }
else{
alert(“No”); }
執行結果