选择所有对角线单元格
重要性:5
编写代码将所有对角线表格单元格涂成红色。
您需要从 <table> 中获取所有对角线 <td> 并使用以下代码对其进行绘制
// td should be the reference to the table cell
td.style.backgroundColor = 'red';
结果应该是
我们将使用 rows 和 cells 属性来访问对角线表格单元格。
编写代码将所有对角线表格单元格涂成红色。
您需要从 <table> 中获取所有对角线 <td> 并使用以下代码对其进行绘制
// td should be the reference to the table cell
td.style.backgroundColor = 'red';
结果应该是
我们将使用 rows 和 cells 属性来访问对角线表格单元格。