Setting Window Background Colors

I have created several windows and attached divs, charts and grids. Is there a way to set the background color of the window object through code? I’m sure this can be done by modifying the theme’s stylesheet but I need to change the colors dynamically

Something like the following.
w4= dhxWins.createWindow(“w4”, 20 , 20, 500, 500);
w4.style.background = “blue”;

This creates the window okay, but does not change the background color.

You were close to the right solution:

w4.firstChild.style.background = “blue”;

Thank you for the promp response.
That seems to set the header and outside of the window but not the body itself.

I was hoping to set the background color of the window contents.

Thanks again,
Drew

There are two possible approaches:

  1. to define bg color for the content:
...
... win.attachObject('obj'); document.getElementById("obj").style.backgroundColor = "red";
  1. using private method and properties:

win.attachObject(…);
win.getView().dhxcont.firstChild.style.backgroundColor = “blue”

That’s great thanks!

Hopefully one last question. How to I set the boarder/background color back to the theme default? I need to change the colors dynamically occasionaly I also need to return them back to their original colors.

For example, when I set…
window.firstChild.style.background = “red”;

How do I now change it back to the default theme background?
I have tried the following but it just sets it back to a plain blue background, not the nice one included with the dhx_skyblue theme:
window.firstChild.style.background = “”;

You will need to redefine the background color, image and repeat acording to the skyblue skin:

win.firstChild.style.background = “#c2d5dc”;
win.firstChild.style.backgroundImage = “url(codebase/imgs/dhxwins_dhx_skyblue/active/header_bg.gif)”;
win.firstChild.style.backgroundRepeat = “repeat-x”;

Thanks,
Your example seems to work great in IE but not if firefox.
In IE the windows goes back to normal, in firefox it looks a little different. I have attached a screenshot to help

We have not reproduced the issue locally. Could you attach the completed demo.