new document
//xxbh:學校編號,bjbh:班級編號,xx:姓名
vararrjson=[
{'xxbh':'1001','bjbh':'0801','xx':'李四'},{'xxbh':'1001','bjbh':'0802','xx':'張三'},
{'xxbh':'1003','bjbh':'0803','xx':'王五'},{'xxbh':'1003','bjbh':'0804','xx':'晶晶'},
{'xxbh':'1005','bjbh':'0701','xx':'亮亮'},{'xxbh':'1002','bjbh':'0701','xx':'明敏'},
{'xxbh':'1005','bjbh':'0701','xx':'張燦'},{'xxbh':'1002','bjbh':'0801','xx':'小白'},
{'xxbh':'1005','bjbh':'0802','xx':'小胖'},{'xxbh':'1002','bjbh':'0901','xx':'小麗'},
{'xxbh':'1003','bjbh':'0901','xx':'阿寶'},{'xxbh':'1004','bjbh':'0901','xx':'王泰'},
{'xxbh':'1001','bjbh':'0901','xx':'阿毛'},{'xxbh':'1006','bjbh':'0901','xx':'李銘'},
{'xxbh':'1005','bjbh':'0901','xx':'阿城'},{'xxbh':'1004','bjbh':'0901','xx':'張曉'},
{'xxbh':'1006','bjbh':'0901','xx':'小小'},{'xxbh':'1004','bjbh':'0901','xx':'白晝'},
{'xxbh':'1002','bjbh':'0901','xx':'樂樂'},{'xxbh':'1001','bjbh':'0901','xx':'黎明'}
];
functioncreatmapbyxxbh(arrjson){
varxxbhmap={};
varlen = arrjson.length;
for(var i=0;i<len;i++){
if(xxbhmap[arrjson[i].xxbh] ==undefined){
varlist = [];
list.push(arrjson[i]);
xxbhmap[arrjson[i].xxbh] = list;
}else{
xxbhmap[arrjson[i].xxbh].push(arrjson[i]);
}
}
varstr="<table><tr><td>11</td>";
for(varxxbhinxxbhmap){
varstu = xxbhmap[xxbh];
/*? alert(stu.length);*/
"+xxbh+"
for(vari =0;i < stu.length;i++){
if(i==0){
"+stu[i].bjbh+""+stu[i].xx+"
}else{
"+stu[i].bjbh+""+stu[i].xx+"
}
}
"+xxbh+"共有"+stu.length+"個班級
}
str+=" ";
document.write(str)
}