Helpful Information
 
 
Category: JavaScript Development
changing layer properties in Javascript

Hi,

I have a couple layers that I would like to change the background color for in Javascript. How do I do this?

I tried this... but it gave me an error.

document["lyr"].layer-background-color = "red";

The dashes in the layer-background-color property causes error in Netscape.

Can someone please help me, Thanks.

I have tried to change layer properties too, but to no avail. This is particularly problematic when using tables in layers. However, I think your issue may be that you may be mixing style syntax with JS syntax. try:

documents[yourlayername].bgcolor = red;

instead.

both wrong...

document.layers[layername].bgColor = myColor

Later,

click_46

As far as I know, when you use style syntax, and have anything with a '-' in it, you got to remove the '-' and capitalize the character after it to get it to work in JS.
So 'layer-background-color' would be
'layerBackgroundColor'.

------------------
Peter.G
peter@gladh.com










privacy (GDPR)