можно допустим так сделать
<!DOCTYPE HTML>
<html>
<head> </head>
<body>
<table >
<thead>
<tr>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>6</th>
</tr>
</thead>
</table>
<script>
!function () {
var html_table = document.body.getElementsByTagName("tr")[0];
var colls = html_table.innerHTML;
colls = colls.replace(/(<[^\/]+>)|\s/g,'');
colls = colls.replace(/<[^>]+>/g,',');
colls = colls.split(",");
var compare = function (a,b) {
return b - a;
}
colls = colls.sort(compare).join(" ");
colls = colls.replace(/\d+/g,function (num) {
return "<th>"+num+"</th>"
});
html_table.innerHTML = colls;
}();
</script>
</body>
</html>
или как в это примере
http://learn.javascript.ru/play/tuto...ort/index.html