using this code the alerts tell me what row and cell the word "Entered" is in - is there a way I can set the background colour to red for that row ?
Code:
<html>
<head>
</head>
<body >
<table id='myTable' border="1px" >
<TR>
<TD>09/11/2012</TD>
<TD>TESTA</TD>
<TD>TESTB</TD>
<TD>TESTC</TD>
</TR>
<TR>
<TD>09/11/2012</TD>
<TD>TESTD</TD>
<TD>TESTE</TD>
<TD>TESTF</TD>
</TR>
<TR>
<TD>09/11/2012</TD>
<TD>TESTG</TD>
<TD>TESTH</TD>
<TD>ENTERED</TD>
</TR>
</table>
<script type="text/javascript">
var mytable = document.getElementById("myTable")
var ttl;
var j;
var col;
// Loop through all rows and columns of the table and popup alert with the value
// /content of each cell.
for ( var i = 0; row = mytable.rows[i]; i++ )
{
row = mytable.rows[i];
for ( var j = 0; col = row.cells[j]; j++ )
{
var TextfromCells = (col.innerHTML);
if(TextfromCells.indexOf("ENTERED") != -1)
{
alert("ENTERED" );
alert("Row"+(i+1));
alert("Cell"+(j+1));
}
}
}
</script>
</body>
</html>