I cannot get my if statement to work? I am trying to compare the background color of a table cell within an if statement (i.e. I cannot get the false to work here):
<!DOCTYPE html>
<html>
<body>
<table id="tbl" border="1">
<tr>
<td>ONE</td>
<td>TWO</td>
<td>THREE</td>
</tr>
<tr>
<td>FOUR</td>
<td style="background-color:yellow" onclick="changeColor()">FIVE</td>
<td>SIX</td>
</tr>
<tr>
<td>SEVEN</td>
<td>EIGHT</td>
<td>NINE</td>
</tr>
</table>
<script type="text/javascript">
function changeColor() {
if (tbl.rows[1].cells[1].style.background = '#00f') {
alert("true")
} else {
alert("false")
}
}
</script>
</body>
</html>