日期:2014-05-16 浏览次数:20592 次
var menuHead = { "standard_": "标准", "style_": "样式", "code_": "代码"};
for(var key in menuHead ) { var value= menuHead[key]; alert(key+":"+value); }
var strs =[{"1":2},{"1":4},{"2":2},{"2":4}]; strs.push({"mm","very beautiful"});//还可以这样加
for(var key in strs) { for(var k in strs[key]) { value = strs[key][k]; alert(k+":"+value);//读取key: value: } }
var strs =[{"key":1,"value",1},{"key":2,"value",20}];
for(var key in strs) { var value = strs[key]["value"]; var k= strs[key]["key"]; alert(k+":"+value);//读取key: value: }