This:
[code=php]alert(document.getElementById(‘cell_1’).style.backgroundColor);
is just returning a blank. Is it not possible to read style from an element in this fashion? Here’s the rest of the script:
[code=php]<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<style type=”text/css”>
table{
border: 1px solid #000;
}
td{
width: 80px;
height: 100px;
border: 1px solid #000;
}
#cell_1{
background-color: #0f0
}
#cell_2{
background-color: #00f
}
#cell_3{
background-color: #c0f
}
#cell_4{
background-color: #f92
}
#cell_5{
background-color: #f00
}
#cell_6{
background-color: #ff0
}
#cell_7{
background-color:
}
</style>
<title>Untitled</title>
</head>
<body>
<table>
<tr>
<td id=”cell_1″ onclick=”move(this.id);”> </td>
<td id=”cell_2″ onclick=”move(this.id);”> </td>
<td id=”cell_3″ onclick=”move(this.id);”> </td>
<td id=”cell_4″ onclick=”move(this.id);”> </td>
<td id=”cell_5″ onclick=”move(this.id);”> </td>
<td id=”cell_6″ onclick=”move(this.id);”> </td>
<td id=”cell_7″ onclick=”move(this.id);”> </td>
</tr>
</table>
<script type=”text/javascript”>
alert(document.getElementById(‘cell_1’).style.backgroundColor);
</script>
</body>
</html>