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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I change the background colo

Status
Not open for further replies.

TechnicalAnalysis

Programmer
Jul 2, 2001
169
US
How do I change the background color of cells in table for NS 4.x?

The script below only works in IE. I tried to change it to document.layers. something.
It doesn't work either. Could we get something like this working in NS?


function changebgcolo(cellslayer,cellscolor) {
eval("document.all."+cellslayer+".style.background='"+cellscolor+"'");
}


<table>
<tr><td id=&quot;cells1&quot; style=&quot;background-color:#EFEFEF&quot;><a href=&quot;#&quot; onClick=changebgcolo('cells1','red')>blah</a><td id=&quot;cells2&quot; style=&quot;background-color:#EFEFEF&quot;><a href=&quot;#&quot; onClick=changebgcolo('cells2','red')>blah,blah</a>
</table>

 
you can't refer to a td in nn, even if you name it
that's why i gave you the DIV example
embed a div or a span INSIDE the td :
<tr><td><div id=cells1 ...>.....</div></td></tr>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top