数组对象通用
function sort(data, sortFiled, orderby) { var result = data, temp; for (var i = 0; i < result.length; i++) { for (var j = 0; j < i; j++) { var resultfiled_i = result[i][sortFiled] || 0, resultfiled_j = result[j][sortFiled] || 0; if (orderby === 'desc') { if (parseInt(resultfiled_i) > parseInt(resultfiled_j)) { temp = result[j]; result[j] = result[i]; result[i] = temp; } } else { if (parseInt(resultfiled_i) < parseInt(resultfiled_j)) { temp = result[j]; result[j] = result[i]; result[i] = temp; } } } } return result; }