Почему-то так не работает?
strTabl+= "<td" + (k == m ? " style=color:red" : "") + ">"+rew(k,m)+"</td>";
var strTabl="<table border=1><tbody>\n";
for (k = 0; k < u.length; k++) {
strTabl+= "\n<tr>\n";
for (m = 0; m < u.length; m++) {
//strTabl+= "<td>"+rew(k,m)+"</td>";
strTabl+= "<td" + (k == m ? " style=color:red" : "") + ">"+rew(k,m)+"</td>";
}
strTabl+= "\n</tr>\n";
}
strTabl+= "\n</tbody></table>";
document.write (strTabl);