In HTML, how can I make a button that reverse sorts a massive.. $m = explode($s) form_method="POST"
I assume you mean client-side, not just HTML. If so, use Array.sort()
.
http://www.javascriptkit.com/javatutors/arraysort.shtml
"Massive" is a completely relative term, but I have tested Array.Sort
with complex object sorts for arrays containing a couple thousand items with no issues.
Simplified, it looks like this.
<input type="button" onclick="PerformSort()" />
<script>
function PerformSort()
{
var arr = [];
// populate 'arr' with items to sort
arr.sort();
// output sorted results to DOM
}
</script>
精彩评论