标签:
var dataList=[]; var stock0={stockcode:"007758",stockname:"商业政7",state:"1"}; var stock1={stockcode:"006658",stockname:"材料政8",state:"1"}; var stock2={stockcode:"023758",stockname:"深发政9",state:"1"}; var stock3={stockcode:"007368",stockname:"思迪政10",state:"1"}; var stock4={stockcode:"033358",stockname:"指数政11",state:"1"}; dataList.push(stock0); dataList.push(stock1); dataList.push(stock2); dataList.push(stock3); dataList.push(stock4); var code="033358"; for(var i=0,l=dataList.length;i<l;i++) { if(dataList[i][‘stockcode‘].indexOf(code) != -1) { //遍历对象内所有值 //for(var key in dataList[i]) //{alert(key+dataList1[i][key]); //} //遍历对象其中的一个值 dataList[i][‘state‘]="<span>已添加</span>"; dataList.push(dataList[i]); // alert("已经添加!"+dataList1[i][‘stockname‘]); layerUtils.iAlert("添加成功!",0); } }
标签:
原文地址:http://www.cnblogs.com/wangzhuxing/p/5316604.html