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

Style Sheet Issues

Status
Not open for further replies.

ded

Programmer
Nov 3, 2000
41
0
0
GB
I have written this piece of code which will change the background colour of a table cell and the text colour of a link within it. This will only work in IE. Does anyone have any pointers on how to get it to work with Netscape?

Code:
function changeButtonColor(id) {
if(document.getElementById) {
cell = document.getElementById(id+"Tab");
cell.background = "buttons/orangedot.gif";
theLink = document.getElementById(id+"Link");
theLink.style.color = "black";
} else {
// Netscape bit
}
}

Cheers,
Duncan
 
for netscape 4.x you would need to use

document.layers[]

and for ie4 you need to use

document.all[]

however for ns4 you also need to drop the .style when refernecing an elements style properties so it would be for example

thelink.color="black";

hope this helps

rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top