js 中键值对 数组长度获取方法
<script type="text/javascript"> var v = [ {"CN " : "china "}, {"US " : "usa "}, {"UK " : "english "} ]; alert(v.length); // 获取数组长度 alert(v[0]["CN "]); //以键取值 alert(v[1]["US "]); //以键取值 alert(v[2]["UK "]); //以键取值 </script>
1 list = { "UserName": "tonykan", "Password": "12345678" } 2 alert(list["UserName"]);