标签:
<html> <head> <title></title> <script type="text/javascript" src="jquery-1.8.2.min.js"></script> <script type="text/javascript"> var students=[ {name:"Tom",age:"18"}, {name:"Jack",age:"16"}, {name:"Peter",age:"20"} ]; students.sort(function(a,b) { if(a.age>b.age) return 1; if(a.age<b.age) return -1; return 0; }); students.sort(); $.each(students,function(n,item){ alert(n+"-"+item.name+"-"+item.age); }); </script> </head> <body> </body> </html>
标签:
原文地址:http://www.cnblogs.com/huanghaihua/p/4836357.html