数字排序

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数字排序</title>
</head>
<body>
<script src="http://vscss.com/dm/jquery.js"></script>
<script>
$(function(){
var sortFn = function(v1,v2){
    return v1-v2;    
}
var box = [1,8,0,20,14,2];
alert(box.sort(sortFn))
});
</script>
</body>
</html>

 

posted on 2016-07-05 15:24  jasonduanmu  阅读(117)  评论(0编辑  收藏  举报

导航