日期:2014-05-16 浏览次数:20453 次
var dataArray1 = new Array();
var dataArray2 = new Array();
for(var i = 0 ; i < 4 ; i++){
?var bean = {};
?bean.name = "cdxh" + i;
?bean.tel = "wr" + i;
?bean.el = "el" + i;
?dataArray1.push(bean);
}
for(var i = 0 ; i < 5 ; i++){
?var bean = {};
?bean.name = "cdx" + (i + 2);
?bean.tel = "wr" + (i + 2);
?bean.el = "elm" + (i + 2);
?dataArray2.push(bean);
}
//alert(dataArray1.length);
//alert(dataArray2.length);
var dd = new Array();
var mm ;
for(var m = 0 ; m < dataArray1.length ; m++){
?var tel = dataArray1[m].tel;
?var flag = true;
?for(var n = 0 ; n < dataArray2.length ; n++){
??var teld = dataArray2[n].tel;
??if(teld == tel){
???//dataArray1.splice(m,1);
???flag = false;
???break;
??}
?}
?if(flag){
??dd.push(dataArray1[m]);
?}
}
// name:cdxh0,tel:wr0,el:el0
// name:cdxh1,tel:wr1,el:el1
// name:cdxh3,tel:wr3,el:el3
// name:cdx2,tel:wr2,el:elm2
// name:cdx3,tel:wr3,el:elm3
// name:cdx4,tel:wr4,el:elm4
// name:cdx5,tel:wr5,el:elm5
// name:cdx6,tel:wr6,el:elm6
alert(dd.length);
var mm = dd.concat(dataArray2);
alert(mm.length);
for(var n = 0 ; n < mm.length ; n++){
?alert("name:"+mm[n].name+",tel:"+mm[n].tel+",el:"+mm[n].el);
}