<script>
var array = new Array(1,2,5,1,4,4,2,3,5,1,1,5,5,5,6,7,3,9,9,10);
var arr = new Array();
var test = new Array();
var num = 1;
var temp = "";
var size = array.length;
for(var i=0;i<size; i++){
for(var j=i+1;j<size; j++){
if(array[i] == array[j]){
array.splice(j,1)
size--;
j--;
num ++;
}
}
test[i] = num ;
num = 1;
arr[i] = array[i]
}
for(var i=0;i<size; i++){
document.write("----------------------元素:"+arr[i]+"个数为:"+test[i]+"<br>");
}
</script>