Dictionary °³Ã¼¿¡ key¸¦ ¼³Á¤ÇÑ´Ù.
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Ç×»ó Dictionary °³Ã¼ÀÇ À̸§ÀÌ´Ù.
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, º¯°æµÉ Key °ªÀÌ´Ù.
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Ç׸ñÀ» ÁöÁ¤ÇÏ´Âkey °ªÀÌ´Ù.
¼±ÅÃÀûÀÎ ¿ä¼ÒÀ̸ç, ÁöÁ¤ÇÑ key¸¦ ´ëüÇÒ »õ·Î¿î °ªÀÌ´Ù.
Dictionary °³Ã¼¿¡ Key¸¦ ¼³Á¤ÇÑ´Ù.
key¸¦ º¯°æÇÒ ¶§ key¸¦ ãÀ» ¼ö ¾øÀ¸¸é »õ·Î¿î key°ªÀ» ¸¸µé°í ÇØ´ç Item ¼Ó¼º°ªÀº ºñ¿öµÐ´Ù.
<SCRIPT language=JScript> var dicObj; function CreateDic(){ var VBObj,i,str=''; // º¯¼ö¸¦ ¸¸µç´Ù. dicObj=new ActiveXObject('Scripting.Dictionary'); dicObj.Add('a','»ç°ú'); // Å°¿Í Ç׸ñÀ» Ãß°¡ÇÑ´Ù. dicObj.Add('b','¹Ù³ª³ª'); dicObj.Add('c','ü¸®'); VBObj=(new VBArray(dicObj.Keys())); // Å°¸¦ °¡Á®¿Â´Ù. for (i=0;i<dicObj.Count;i++){ // dictionary¸¦ ¹Ýº¹ÇÑ´Ù. str+=VBObj.getItem(i)+' - '+dicObj(VBObj.getItem(i))+'<BR>'; } str+='dicObj.Count='+dicObj.Count+'<BR>'; return(str); } function KeyTest(key){ var str=CreateDic(); str+='dicObj.Item("'+key+'")='+dicObj.Item(key); return(str); } function ChangeKey(oldkey,newkey){ var str=CreateDic(); dicObj.Key(oldkey)=newkey; str+='"'+oldkey+'"Å°°¡ "'+newkey+'"·Î º¯°æµÇ¾ú´Ù.<BR> '; str+='dicObj.Item("'+newkey+'")='+dicObj.Item(newkey); return(str); } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="id=showjs.innerHTML=KeyTest('c')"> <SPAN class=ie>JScript</SPAN> <SPAN class=property>Key</SPAN> ¼Ó¼º È£Ãâ ¿¹Á¦</DIV> <DIV class=show onClick="id=showjs.innerHTML=ChangeKey('c','cherry')"> <SPAN class=ie>JScript</SPAN> <SPAN class=property>Key</SPAN> ¼Ó¼º º¯°æ ¿¹Á¦</DIV>
<SCRIPT language=VBScript> Dim dicObj Function CreateDicvb Dim i,str ' º¯¼ö¸¦ ¸¸µç´Ù. Set dicObj=CreateObject("Scripting.Dictionary") dicObj.Add "a","»ç°ú" ' Å°¿Í Ç׸ñÀ» Ãß°¡ÇÑ´Ù. dicObj.Add "b","¹Ù³ª³ª" dicObj.Add "c","ü¸®" VBObj=dicObj.Keys ' keys¸¦ ¾òÀ½ For i=0 To dicObj.Count -1 ' array¸¦ ¹Ýº¹ÇÑ´Ù. str=str&VBObj(i)&" - "&dicObj(VBObj(i))&"<BR>" ' ¹Ýȯ ¹®ÀÚ¿À» ¸¸µç´Ù. Next str=str&"dicObj.Count="&dicObj.Count&"<BR>" CreateDicvb=str End Function Function KeyTestvb(key) str=CreateDicvb str=str&"dicObj.Item(key)="&dicObj.Item(key) KeyTestvb=str End Function Function ChangeKeyvb(oldkey,newkey) str=CreateDicvb dicObj.Key(oldkey)=newkey str=str&"'"&oldkey&"'"&"'Å°°¡ '"&newkey&"'·Î º¯°æµÇ¾ú´Ù.<BR>" str=str&"dicObj.Item('"&newkey&"')="&dicObj.Item(newkey) ChangeKeyvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="id=showvb.innerHTML=KeyTestvb('c')"> <SPAN class=ie>VBScript</SPAN> <SPAN class=property>Key</SPAN> ¼Ó¼º È£Ãâ ¿¹Á¦</DIV> <DIV class=show onClick="id=showvb.innerHTML=ChangeKeyvb('c','cherry')"> <SPAN class=ie>VBScript</SPAN> <SPAN class=property>Key</SPAN> ¼Ó¼º º¯°æ ¿¹Á¦</DIV>