I have a site where I am setting a style dynamically, using the JS
statement:
obj.style.backgroundImage = 'url(img/bak_page.jpg)';
where 'obj' is either document.getElementById(id), or document.all[id],
depending on browser support.
This works just fine, with just one small problem: I want to set the style
ONLY for screen media, not for printer media; the above statement appears to
apply the style to all media.
In CSS I have previously set the style for print media using code of the
form:
@media print
{
html#html { background-image:none; }
}
and this works just fine (it prevents printing of a page's background image
when printing) UNLESS I later dynamically change the style using JS.
How can I dynamically change the style only for a specified medium?