Scripting Runtime Library(Dictionary)
Dictionary °³Ã¼¿¡ Å°-Ç׸ñ ½ÖÀ» Ãß°¡ÇÑ´Ù.
key°¡ ÀÌ¹Ì Á¸ÀçÇÏ´Â °æ¿ì¿¡´Â ¿À·ù°¡ ¹ß»ýÇÑ´Ù.
<SCRIPT language=JScript> function AddTest(){ var DicObj,str=''; DicObj=new ActiveXObject('Scripting.Dictionary'); DicObj.Add('a','»ç°ú'); DicObj.Add('b','¹Ù³ª³ª'); DicObj.Add('c','ü¸®'); KeyArr=new VBArray(DicObj.Keys()).toArray(); // Key Ç׸ñÀ» °¡Á®¿Â´Ù. DicArr=new VBArray(DicObj.Items()).toArray(); // Ç׸ñÀ» °¡Á®¿Â´Ù. for (numb in DicArr){ // dictionary¸¦ ¹Ýº¹ÇÑ´Ù. str+=numb+') "'+KeyArr[numb]+'"='+DicArr[numb]+'<BR>'; } return(str); } </SCRIPT> <DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showjs.innerHTML=AddTest()"> <SPAN class=ie>JScript</SPAN> <SPAN class=method>Add</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>
<SCRIPT language=VBScript> Function AddTestvb Dim DicObj,DicArr,i,str ' º¯¼ö¸¦ ¸¸µç´Ù. Set DicObj=CreateObject("Scripting.Dictionary") DicObj.Add "a","»ç°ú" ' Å°¿Í Ç׸ñÀ» Ãß°¡ÇÑ´Ù. DicObj.Add "b","¹Ù³ª³ª" DicObj.Add "c","ü¸®" DicArr=DicObj.Keys ' Å°¸¦ °¡Á®¿Â´Ù. For i=0 To DicObj.Count-1 ' dictionary¸¦ ¹Ýº¹ÇÑ´Ù. str=str&"'"&DicArr(i)&"' : "&DicObj.Item(DicArr(i))&"<BR>" ' °á°ú¸¦ ¹ÝȯÇÑ´Ù. Next AddTestvb=str End Function </SCRIPT> <DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV> <DIV class=show onClick="showvb.innerHTML=AddTestvb()"> <SPAN class=ie>VBScript</SPAN> <SPAN class=method>Add</SPAN> ¸Þ¼µå ¿¹Á¦</DIV>