疯狂

STANDING ON THE SHOULDERS OF GIANTS
posts - 481, comments - 486, trackbacks - 0, articles - 1
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

js数组排序

Posted on 2010-05-16 14:20 疯狂 阅读(337) 评论(0)  编辑  收藏 所属分类: java
< html >
< body >
 
< script  type ="text/javascript" >
function  AscSort(x, y) 
{
  
return  x  ==  y  ?   0  : (x  >  y  ?   1  :  - 1 );
}


function  DescSort(x, y) 
{
  
return  x  ==  y  ?   0  : (x  >  y  ?   - 1  :  1 );
}

 
var  y  =   new  Array(3, 1 , 2 );
 y.sort(AscSort);
 alert(y);
</ script >
</ body >
</ html >

只有注册用户登录后才能发表评论。


网站导航: