Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

toggle text in layer

Status
Not open for further replies.

greyone

Programmer
Dec 14, 2000
200
CA
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=&quot;javascript&quot;>

var selectedRow = &quot;undefined&quot;;
function SelectRow( rowID ){
if( selectedRow != &quot;undefined&quot; )
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( &quot;document.all.row&quot; + rowNumber );
targetRow.bgColor = &quot;white&quot;;
}

function MSIEHighlightRow( rowNumber ){
var targetRow = eval( &quot;document.all.row&quot; + rowNumber );
targetRow.bgColor = &quot;blue&quot;;
}

</script>

<layer z-index=1>
<table width=400 cellspacing=0 cellpadding=0 border=1>
<tr id=&quot;row0&quot;>
<td width=50 onclick=&quot;JavaScript:SelectRow( 0 )&quot;>0</td>
<td width=250 onclick=&quot;JavaScript:SelectRow( 0 )&quot;>Carol Cunnings</td>
<td width=100 onclick=&quot;JavaScript:SelectRow( 0 )&quot;>555-7890</td></tr>
<tr id=&quot;row1&quot;>
<td width=50 onclick=&quot;JavaScript:SelectRow( 1 )&quot;>1</td>
<td width=250 onclick=&quot;JavaScript:SelectRow( 1 )&quot;>Jane Doe</td>
<td width=100 onclick=&quot;JavaScript:SelectRow( 1 )&quot;>555-1234</td></tr>
</table>
</layer>
 
onclick, change the cells className property. this will allow you to change the appearance (bold it or whatever so they know its selected) and you can test against the clasName property jared@aauser.com
 
could you give me an example because i tried to do it and it did'nt work
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top