var oTab13_7_2 = document.getElementById('tab13_7');
var oBtn13_7_2 = document.getElementById('btn13_7');
oBtn13_7_2.onclick = function ()
{
var arr = [];
for (var i = 0; i < oTab13_7_2.tBodies[0].rows.length; i++)
{
arr[i] = oTab13_7_2.tBodies[0].rows[i];
}
arr.sort(function (tr1, tr2)
{
var n1 = parseInt(tr1.cells[0].innerHTML);
var n2 = parseInt(tr2.cells[0].innerHTML);
return n1 - n2;
});
//When the sort() function compares two values, it sends the values to the compare function, and sorts the values
according to the returned (negative, zero, positive) value.
for (var i = 0; i < arr.length; i++)
{
oTab13_7_2.tBodies[0].appendChild(arr[i]);
}
};