VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > 网站开发 > JavaScript >
  • JavaScript教程之JS 遍历Key、Value字典对象

var dic = {"S":[{"key":"14A5EA54-83BB-494E-954F-7CCFCD5D5FBE","value":"顺丰快递","initial":"S"}],"Y":[{"key":"E1CAF921-9121-4BA5-A282-70BFDB9FED98","value":"圆通快递","initial":"Y"},{"key":"4C1D5494-E8A8-45DF-B0BD-B06FDE7C2533","value":"韵达快递","initial":"Y"}],"Z":[{"key":"88C06E9A-0694-4780-95C8-8E4CFC315FE3","value":"中通快递","initial":"Z"}]}
var arr = []
arr.push(dic)

for(var i=0,m=arr.length;i<m;i++){
  for(var key in arr[i]){
    for(var j=0,n=arr[i][key].length;j<n;j++){
      alert(key+':'+arr[i][key][j].value);
    }
  }
}

相关教程