Can I adjust this code which displays a table to run faster?
You don't need to redraw the entire table. Try just doing DOM manipulation to reorder the TRs.  I see that you also want to stripe the rows, but you can still do it with DOM manipulation. You should be able to take it from there.

I created a simple example with almost 1000 rows and it runs almost instantaneously. There's some jQuery just so I don't have to worry about cross-browser issues. If you don't use jQuery, most libraries have the functionality I used,or you can just implement $.text on your own http://jsfiddle.net/unffs/2

var table = document.getElementById('tbl');
// Can't call sort on an HTML collection, so copy the contents to an array
var rows = Array.prototype.slice.call(table.rows);
rows.sort(function(a, b) {
    var aVal = $(a).text(), bVal = $(b).text(); 
    return aVal &gt; bVal ? 1 : (bVal &gt; aVal ? -1 : 0);
});
var tbody = document.getElementById('tbody');
for (var i=0; i &lt; rows.length; i++) {
    tbody.appendChild(rows[i]);
}        


That code works for a table like the following

&lt;table id='tbl'&gt;
  &lt;tbody id='tbody'&gt;
    &lt;tr&gt;&lt;td&gt;D&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;A&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;C&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;E&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;F&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;B&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;&lt;td&gt;D&lt;/td&gt;&lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;


Using data to sort instead of HTML

If you have some underlying data for the table, it will be even faster since you won't need to read the DOM (except for an id attribute)

var data  = [
   {id: 1, value: 'C'},
   {id: 2, value: 'B'},
   {id: 3, value: 'D'},
   {id: 4, value: 'A'}
];


And your HTML looks like

&lt;table id='tbl'&gt;
  &lt;tbody id='tbody'&gt;
    &lt;tr id='row-1'&gt;&lt;td&gt;C&lt;/td&gt;&lt;/tr&gt;
    &lt;tr id='row-2'&gt;&lt;td&gt;B&lt;/td&gt;&lt;/tr&gt;
    &lt;tr id='row-3'&gt;&lt;td&gt;D&lt;/td&gt;&lt;/tr&gt;
    &lt;tr id='row-4'&gt;&lt;td&gt;A&lt;/td&gt;&lt;/tr&gt;
 &lt;/tbody&gt;
&lt;/table&gt;


Here's the code to sort the table

var table = document.getElementById('tbl');
// Can't call sort on an HTML collection, so copy the contents to an array
data.sort(function(a, b) {
    return a.value &gt; b.value ? 1 : (b.value &gt; a.value ? -1 : 0);
});
var tbody = document.getElementById('tbody');
for (var i=0; i &lt; data.length; i++) {
    tbody.appendChild(document.getElementById('row-' + data[i].id));
}