当前位置: 代码迷 >> Java Web开发 >> var a ={'key1'{key12:value12,key13:value13},'key2'{key22:value22}} 怎么追加元素
  详细解决方案

var a ={'key1'{key12:value12,key13:value13},'key2'{key22:value22}} 怎么追加元素

热度:9462   发布时间:2016-04-11 00:08:16.0
var a ={'key1':{key12:value12,key13:value13},'key2':{key22:value22}} 如何追加元素
var a ={'key1':{key12:value12,key13:value13},'key2':{key22:value22}} 如何追加元素

------解决方案--------------------
prototype这个不可以么?
------解决方案--------------------

<SCRIPT LANGUAGE="JavaScript">
  <!--
var a ={'key1':{'key12':'value12','key13':'value13'},'key2':{'key22':'value22'}} 
a.key3={'key31':'31','key32':'32'};
alert(a.key3.key31);
  //-->
  </SCRIPT>


------解决方案--------------------
建议看看json字符串
------解决方案--------------------
换个马甲而已,本质还是一个 Object,加个属性即可。