I have a table in a layer which highlights the entire cell on the on click event as shown below. Now the problem is that i need to change text within the cell on click of a button and before that i need to also check whether the cell is highlighted or not. Is there a way to do this?? Please help
<script language="javascript">
var selectedRow = "undefined";
function SelectRow( rowID ){
if( selectedRow != "undefined" )
UnHighlightRow( selectedRow );
rowNumber = rowID;
HighlightRow( rowNumber );
selectedRow = rowNumber;
}
if( navigator.appName.search( /Microsoft Internet Explorer/i ) > -1 ){
HighlightRow = MSIEHighlightRow;
UnHighlightRow = MSIEUnHighlightRow;
}
else{
HighlightRow = NetscapeHighlightRow;
UnHighlightRow = NetscapeUnHighlightRow;
}
function MSIEUnHighlightRow( rowNumber ){
var targetRow = eval( "document.all.row" + rowNumber );
targetRow.bgColor = "white";
}
function MSIEHighlightRow( rowNumber ){
var targetRow = eval( "document.all.row" + rowNumber );
targetRow.bgColor = "blue";
}
</script>
<layer z-index=1>
<table width=400 cellspacing=0 cellpadding=0 border=1>
<tr id="row0">
<td width=50 onclick="JavaScript:SelectRow( 0 )">0</td>
<td width=250 onclick="JavaScript:SelectRow( 0 )">Carol Cunnings</td>
<td width=100 onclick="JavaScript:SelectRow( 0 )">555-7890</td></tr>
<tr id="row1">
<td width=50 onclick="JavaScript:SelectRow( 1 )">1</td>
<td width=250 onclick="JavaScript:SelectRow( 1 )">Jane Doe</td>
<td width=100 onclick="JavaScript:SelectRow( 1 )">555-1234</td></tr>
</table>
</layer>
<script language="javascript">
var selectedRow = "undefined";
function SelectRow( rowID ){
if( selectedRow != "undefined" )
UnHighlightRow( selectedRow );
rowNumber = rowID;
HighlightRow( rowNumber );
selectedRow = rowNumber;
}
if( navigator.appName.search( /Microsoft Internet Explorer/i ) > -1 ){
HighlightRow = MSIEHighlightRow;
UnHighlightRow = MSIEUnHighlightRow;
}
else{
HighlightRow = NetscapeHighlightRow;
UnHighlightRow = NetscapeUnHighlightRow;
}
function MSIEUnHighlightRow( rowNumber ){
var targetRow = eval( "document.all.row" + rowNumber );
targetRow.bgColor = "white";
}
function MSIEHighlightRow( rowNumber ){
var targetRow = eval( "document.all.row" + rowNumber );
targetRow.bgColor = "blue";
}
</script>
<layer z-index=1>
<table width=400 cellspacing=0 cellpadding=0 border=1>
<tr id="row0">
<td width=50 onclick="JavaScript:SelectRow( 0 )">0</td>
<td width=250 onclick="JavaScript:SelectRow( 0 )">Carol Cunnings</td>
<td width=100 onclick="JavaScript:SelectRow( 0 )">555-7890</td></tr>
<tr id="row1">
<td width=50 onclick="JavaScript:SelectRow( 1 )">1</td>
<td width=250 onclick="JavaScript:SelectRow( 1 )">Jane Doe</td>
<td width=100 onclick="JavaScript:SelectRow( 1 )">555-1234</td></tr>
</table>
</layer>