日期:2014-05-16  浏览次数:20479 次

获取JSON格式数据的key和alue

<script language="javascript">  
  function e()  
  {  
    var json=[{"kl_id":"2","kl_title":"Test date","kl_content":"Test date","kl_type":"1","id":"1"},{"kl_id":"2","kl_title":"Test","kl_content":"Test","kl_type":"1","id":"2"}]  
    var str = "";

    for(var i = 0; i < json.length; i++)
    {
      var a = json[i]
      for (var key in a)
      {

           str += key + ":" + a[key]+ ",";
      }
    }

    alert(str);
  }

  e();
 </script>
?