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!

Changing background colours

Status
Not open for further replies.

Badgers

Programmer
Nov 20, 2001
187
US
Before you ask this is a little more complicated than it sounds.

What I'm trying to achieve is a generic piece of code that will reformat background colours on TD within a div, with out giving each TD an ID to reset the innerHTML.

The problem.

1. I create a div within a page which has background colours set on various TD's.

2. Within the application I want to create a print report, I try to re-use the existing div and print it. (Code efficiency and all that).

I create a new div, for example divPrint and set the contents of the original div to it. The problem is I want to reset all the background TD colours to white for the print out.

What I've tried so far.

1. Setting the background colour to white, this worked but because HTML is already set currently TD colour takes preference.

2. Using the document.all method to create an array of all the TDS and attempted to update each one for example, "oObject(i).tagName.style.background = 'white';" this is bad syntax and just does not work.

Any help would make me a very happy chap!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top