<script type="text/javascript">
window.onload=function(){
/*数组去重方法一*/
/*var arr=[1,1,2,545,5,15,156,1,5,15];
var arr1=[];
for(var i=0;i<arr.length;i++){
if(arr1.indexOf(arr[i])==-1){
arr1.push(arr[i]);
};
};
alert(arr1);
*/
/*数组去重方法二*/
/* var arr0=[1,1,5,5,2,3,2,6,56,3,4,5];
var arr2=[];
var repeat={};
for(var i=0;i<arr0.length;i++){
if(!repeat[arr0[i]]){
repeat[arr0[i]]=true;
arr2.push(arr0[i]);
};
};
console.log(arr2);
*/
/*数组去重三*/
/* var arr=[1,1,103,3,2,5,6,15,103,6];
var arr1=[];
var request;
for(var i=0;i<arr.length;i++){
request=false;
for(var j=0;j<arr1.length;j++){
if(arr[i]==arr1[j]){
request=true;
break;
};
};
if(!request){
arr1.push(arr[i]);
};
};
alert(arr1);*/
/*数组去重四*/
var arr=[5,1,103,3,2,5,6,15,103,6];
arr.sort(function(a,b){
return a-b;
});
for(var i=0;i<arr.length;i++){
if(arr[i]==arr[i+1]){
arr.splice(i+1,1);
};
};
alert(arr);
}
</script>