<html><head><script>
function function1(e) {
var srcElement = e.srcElement?e.srcElement:e.target;
if( srcElement.nodeName.toLowerCase() == "td" ) {
var cells = document.getElementsByTagName("table")[0].getElementsByTagName("td");
for(var i=0;i<cells.length;i++) cells[i].bgColor = ""; // remove color for all cells
if( srcElement.bgColor == "" ) {
srcElement.bgColor = "red";
}
else {
srcElement.bgColor = "";
}
}
}
</script></head>
<body bgcolor="#ccffcc" text="#000000">
<table border="1" onClick="function1(event);">
<tr>
<td id="myTD" height="79">Cell 1 content</td>
<td id="myTD" height="79">Cell 1 content</td>
<td id="myTD" height="79">Cell 1 content</td>
<td id="myTD" height="79">Cell 1 content</td>
<td id="myTD" height="79">Cell 1 content</td>
<td id="myTD" height="79">Cell 1 content</td>
<td id="myTD" height="79">Cell 1 content</td>
<td id="myTD" height="79">Cell 1 content</td>
</tr>
</table>
</body></html>
|