zpzpzp
January 7th, 2009, 11:08 PM
Hi
An html table cell is defined as follows:
<td rowspan="2" bgcolor="red" width="10"></td>
Does anyone know how to use javascript to get the bgcolor of this table cell?
I tried this following code, but in the popup window there is nothing displayed (not "undefined".)
var table = document.getElementById("automationTestResults");
var tableBody = table.getElementsByTagName("tbody")[0];
var rows = tableBody.getElementsByTagName("tr");
var cellsInARow = rows[1].getElementsByTagName("td");
alert (cellsInARow[3].style.backgroundColor);
Thanks,
Paul
An html table cell is defined as follows:
<td rowspan="2" bgcolor="red" width="10"></td>
Does anyone know how to use javascript to get the bgcolor of this table cell?
I tried this following code, but in the popup window there is nothing displayed (not "undefined".)
var table = document.getElementById("automationTestResults");
var tableBody = table.getElementsByTagName("tbody")[0];
var rows = tableBody.getElementsByTagName("tr");
var cellsInARow = rows[1].getElementsByTagName("td");
alert (cellsInARow[3].style.backgroundColor);
Thanks,
Paul