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

Change a td's backgroudn color

Status
Not open for further replies.

MaxGeek

Technical User
Jan 8, 2004
52
US
Hi, I'm trying to change a td's color with javascript.

the html looks like this:
<td id="cell0"></td>

the javascript part that I'm having trouble with looks like this.

function highlightBox() {
var currentBox = document.getElementByID("cell0").bgColor;
currentBox.style.backgroundColor = 'black';
}

The part I'm not sure about is the .bgColor I', not sure if thats the correct way to select the td.
 
ahhhh forget it I just looked at it and I have getElementByID when it should be getElementById. I also don't need the .bgcolor part.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top