views:

98

answers:

3

What I am trying to do is change the background colour of a table cell <td> and then when a user goes to print the page, the changes are now showing.

I am currently using an unobtrusive script to run the following command on a range of cells:

element.style.backgroundColor = "#f00"

This works on screen in IE and FF, however, when you go to Print Preview, the background colours are lost.

Am I doing something wrong?

A: 

Have you tried hard-coding the values just to see if background-colors are showing on the print-preview at all? I think it is a setting in the Browser.

Espo
+1  A: 

Is it not recommended to do this with stylesheets? You can change the media type in the LINK statement in your HTML, so when the page is printed, it will revert to the different style?

Rob Cooper
A: 

@Espo: I forgot about the "Print Background Colors" options in the browser. It now works... cheers.

GateKiller