<html>
<head>
<title> New Document title>
<script>
var arrJson=[
{'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':' '}
];
function creatMapByXxbh(arrJson){
var xxbhMap={};
var len = arrJson.length;
for(var i=0;iif(xxbhMap[arrJson[i].xxbh] == undefined){
var list = [];
list.push(arrJson[i]);
xxbhMap[arrJson[i].xxbh] = list;
}else{
xxbhMap[arrJson[i].xxbh].push(arrJson[i]);
}
}
var str="";
for(var xxbh in xxbhMap){
var stu = xxbhMap[xxbh];
alert(stu.length);
str+="";
for(var i = 0;i < stu.length;i++){
")
if(i==0){
str+=""+stu[i].bjbh+""+stu[i].xx+"";
}else{
str+=""+stu[i].bjbh+""+stu[i].xx+"";
}
}
str+=""+xxbh+" "+stu.length+" "
}
str+=" ";
document.write(str)
}
script>
head >
<body>
<button onclick='creatMapByXxbh(arrJson)'> button>
body>
html>