<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>www.vevb.com JS遍历json属性值</title></head><body><script>// js获取对象中的属性值 var slideArray = { slides: [ { "imgsrc": "a.jpg", "url": "", "alt": "这是a图片" }, { "imgsrc": "b.jpg", "url": "", "alt" : "这是b图片" }, { "imgsrc": "c.jpg", "url": "", "alt": "这是c图片" }, { "imgsrc": "d.jpg", "url": "", "alt": "这是d图片" }, { "imgsrc": "e.jpg", "url": "", "alt" : "这是e图片" }] }; //通过以下的方法可以遍历js数组中对象的属性 for(var i=0; i<slideArray.slides.length; i++) { console.log(slideArray.slides[i].imgsrc); }</script></body></html>