比较函数
function createComparisonFunction(propertyName) { return function(obj1, obj2) { var value1 = obj1.getAttribute(propertyName), value2 = obj2.getAttribute(propertyName); if (value1 < value2) { return -1; } else if (value1 > value2) { return 1; } else { return 0; } } }
可用于排序的比较函数

浙公网安备 33010602011771号