"C A Upsdell" <cupsdell0311XXX@-@-@XXXrogers.com> wrote in message
news:bBuSc.1546$x7h.1501@news04.bloor.is.net.cable .rogers.com...[color=blue]
> 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[/color]
style[color=blue]
> ONLY for screen media, not for printer media; the above statement appears[/color]
to[color=blue]
> apply the style to all media.[/color]
Right, you're not changing the rules, you're overriding them by setting a
property directly. You could try to use the CSS-DOM
(
http://www.w3.org/TR/DOM-Level-2-Style/) to change the rule for only one
particular medium. Or, if you have an element somewhere that is affected by
a static property that you've made dependent on the medium, you could check
the value of that property to determine what the actual medium is, and
conditionally set the background image based on that.
[color=blue]
>
> 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[/color]
image[color=blue]
> when printing) UNLESS I later dynamically change the style using JS.
>
> How can I dynamically change the style only for a specified medium?[/color]