<!DOCTYPE html>
<body>
<script>
var strTabl;
var div=document.createElement('div');
function createTable() {
strTabl +="<table border=1><tbody>\n";
for (var k = 0; k < 4; k++) {
strTabl+= "\n<tr>\n";
for (var m = 0; m < 5; m++) {
strTabl+= "<td" + (k == m ? " style=color:red" : "") + ">"+"строка " +k+"; яч "+m+"</td>";
} strTabl+= "\n</tr>\n";
}
strTabl+= "\n</tbody></table>";
}
function run() {
var tstart = new Date();
strTabl = '';
for (var i = 0; i < 1000; i++) {
createTable();
} //alert(strTabl)
div.innerHTML = strTabl;
document.body.appendChild(div);
alert(new Date() - tstart);
}
</script>
<button onclick="run()">Запуск</button>
</body>
Покороче (Ибо долго в ИЕ)
<!DOCTYPE html>
<body>
<script>
var strTabl;
var div=document.createElement('div');
function createTable() {
strTabl +="<table border=1><tbody>\n";
for (var k = 0; k < 4; k++) {
strTabl+= "\n<tr>\n";
for (var m = 0; m < 5; m++) {
strTabl+= "<td" + (k == m ? " style=color:red" : "") + ">"+"строка " +k+"; яч "+m+"</td>";
} strTabl+= "\n</tr>\n";
}
strTabl+= "\n</tbody></table>";
}
function run() {
var tstart = new Date();
strTabl = '';
for (var i = 0; i < 100; i++) {
createTable();
} //alert(strTabl)
div.innerHTML = strTabl;
document.body.appendChild(div);
alert(new Date() - tstart);
}
</script>
<button onclick="run()">Запуск</button>
</body>