JSON排序
//排序之前 var arrs=[{"PageID":"1"},{"PageID":"10"},{"PageID":"2"},{"PageID":"3"},{"PageID":"4"},{"PageID":"5"},{"PageID":"6"},{"PageID":"7"},{"PageID":"8"},{"PageID":"9"}] //由小到大排序 function down(x,y){ return x.PageID - y.PageID; } //由大到小排序 function up(x,y){ return y.PageID - x.PageID; } //排序之后 arrs.sort(down); //[{"PageID":"1"},{"PageID":"2"},{"PageID":"3"},{"PageID":"4"},{"PageID":"5"},{"PageID":"6"},{"PageID":"7"},{"PageID":"8"},{"PageID":"9"},{"PageID":"10"}] arrs.sort(up); //[{"PageID":"10"},{"PageID":"9"},{"PageID":"8"},{"PageID":"7"},{"PageID":"6"},{"PageID":"5"},{"PageID":"4"},{"PageID":"3"},{"PageID":"2"},{"PageID":"1"}]