°á°ú Ç¥½Ãâ
Ŭ¸¯ÇÏ¿© °á°ú¸¦ º¸¶ó.
<DIV id=showDic class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<SCRIPT>
function DictionaryTest(){
var DicArr,dicObj,i; // º¯¼ö¸¦ ¸¸µç´Ù.
str='';
dicObj=new ActiveXObject('Scripting.Dictionary');
dicObj.Add('rose','Àå¹Ì'); // Å°¿Í Ç׸ñÀ» Ãß°¡ÇÑ´Ù.
dicObj.Add('b','¹«±ÃÈ');
dicObj.Add('c','¹éÇÕ');
dicObj.Add('k','±¹È');
ListItems(dicObj);
str+=CheckKey('rose',dicObj)+' '+CheckKey('b',dicObj)+' '+CheckKey('s',dicObj)+'<BR><BR>';
dicObj.Remove('b');
str+='dicObj.Remove("b")<BR>';
ListItems(dicObj);
str+=CheckKey('rose',dicObj)+' '+CheckKey('b',dicObj)+' '+CheckKey('s',dicObj)+'<BR><BR>';
dicObj.RemoveAll();
str+='dicObj.RemoveAll()<BR>';
ListItems(dicObj);
str+=CheckKey('rose',dicObj)+' '+CheckKey('b',dicObj)+' '+CheckKey('s',dicObj)+'<BR><BR>';
showDic.innerHTML=str;
}
function ListItems(dicObj){
KeyArr=new VBArray(dicObj.Keys()).toArray(); // Key Ç׸ñÀ» °¡Á®¿Â´Ù.
DicArr=new VBArray(dicObj.Items()).toArray(); // Ç׸ñÀ» °¡Á®¿Â´Ù.
for (numb in DicArr){ // dictionary¸¦ ¹Ýº¹ÇÑ´Ù.
str+=numb+') "'+KeyArr[numb]+'"='+DicArr[numb]+', ';
}
str+='<BR>';
return KeyArr,DicArr;
}
function CheckKey(dicKey,dicObj){
if (dicObj.Exists(dicKey)) return '"'+dicKey+'"Å°°¡ ÀÖ´Ù.';
else return '"'+dicKey+'"Å°°¡ ¾ø´Ù.';
}
</SCRIPT>
<DIV class=show title="°á°ú" onClick="DictionaryTest()">Ŭ¸¯ÇÏ¿© °á°ú¸¦ º¸¶ó.</DIV>