I’m trying to highlight a cell in a table. Previous I want to set all other cells back to normal. Cant get it to work. Came up with this code:
——————————
<html>
<head>
<style type=”text/css”>
<!–
.tedit {
border: 1px dotted;
}
.teditHL {
border: 1px dotted #FFCCCC;
}
–>
</style>
<script type=”text/javascript”>
function setMe(myCell){
var xRows=document.getElementById(‘myTable’).rows.length;
for(x = 0; x < xRows; x++){
var xCells=document.getElementById(‘myTable’).row[x].cells.length;
for(y = 0; y < xCells; y++){
document.getElementById(‘myTable’).row[x].cell[y].className=’tedit’;
}
}
myCell.className = “teditHL”;
}
</script>
</head>
<body>
<table cellpadding=”10″ cellspacing=”10″ width=”400″ height=”400″ id=”myTable”>
<tr>
<td class=”tedit” onClick=”setMe(this)”>edit</td>
<td class=”tedit” onClick=”setMe(this)”>edit</td>
</tr>
<tr>
<td class=”tedit” onClick=”setMe(this)”>edit</td>
<td class=”tedit” onClick=”setMe(this)”>edit</td>
</tr>
</table>
</body>
can’t get it to work. Can anyone please tell me what i’m doing wrong here? Any solution or suggestion would be more than welcome.