In the HTML you're setting the style
attribute of the td
element to a string with value color:#f00;
, so you'd have to do the same in javascript:
tbl.rows[row].cells[col].style = "color:#f00;";
This is because the style
attribute is a string which must be valid css
, not a javascript object with properties like color
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…