开发者

In HTML, how can I make a button that reverse sorts a massive [closed]

开发者 https://www.devze.com 2023-01-18 02:01 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly开发者_如何学JAVA broad, or rhetorical andcannot be reasonably answered in its current for
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly开发者_如何学JAVA broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

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>
0

精彩评论

暂无评论...
验证码 换一张
取 消