gazman,
внимание на строки 80 и 99
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<table class="sort" id="sort" align="center">
<tr id="zag">
<td>ID</td>
<td>Имя</td>
<td>Фамилия</td>
<td>Сайт</td>
<td>Переключалка стилей</td>
</tr>
<tr>
<td>1</td>
<td>Александр</td>
<td>Шуркаев</td>
<td><a href="#">htmlcoder.visions.ru</a></td>
<td>Не-а</td>
</tr>
<tr>
<td>123</td>
<td>Пол</td>
<td>Соуден</td>
<td><a href="#">idontsmoke.co.uk</a></td>
<td>Угу</td>
</tr>
<tr>
<td>3</td>
<td>Джеффри</td>
<td>Зельдман</td>
<td><a href="#">zeldman.com</a></td>
<td>Угу</td>
</tr>
<tr>
<td>44</td>
<td>Аарон</td>
<td>Будман</td>
<td><a href="#">youngpup.net</a></td>
<td>Не-а</td>
</tr>
<tr>
<td>11</td>
<td>Глен</td>
<td>Мерфи</td>
<td><a href="#">glenmurphy.com</a></td>
<td>Не-а</td>
</tr>
<tr>
<td>15</td>
<td>Даниель</td>
<td>Боган</td>
<td><a href="#">waferbaby.com</a></td>
<td>Не-а</td>
</tr>
<tr>
<td>33</td>
<td>Ден</td>
<td>Бенджамин</td>
<td><a href="#">hivelogic.com</a></td>
<td>Угу</td>
</tr>
</table>
<script>
var table = document.getElementById("sort");
var zag = document.getElementById("sort").rows[0].cells;
var stroke = document.getElementById("sort").rows;
function perebor(zg)
{
for (i=0; i<zg.length; i++)
{
var up = 0;
zg[i].onclick = function ()
{
index = this.cellIndex;
cellRezult = [];
function comp(a, b) {
b = +b[0] || b[0];
a = +a[0] || a[0];
if (a > b) return 1;
if (a < b) return -1;
}
for (i=1; i<table.rows.length; i++)
{
cellRezult[i-1] = [];
cellRezult[i-1][0] = table.rows[i].getElementsByTagName("td").item(index).textContent;
cellRezult[i-1][1] = table.rows[i];
}
cellRezult.sort(comp);
if (up == 0)
{
up = 1;
}
else
{
cellRezult.reverse(comp);
up = 0;
}
for (i=0; i<cellRezult.length; i++)
{
table.appendChild(cellRezult[i][1]);
}
}
}
}
perebor(zag);
</script>
</body>
</html>