on 23/2/01 4:19 pm, Julian Dobson at juliand@w... wrote:
> Luke,
>
> Two points:
>
> First, Netscape doesn't support dynamic changes to styles, so you'll not
> be able to change the background color of the <td> tag this way. You might
> be able to do this be embedding a layer inside the <td>, and changing the
> bgcolor property dynamically, but that might cause the formatting problems.
>
> Second, to change the style in IE, use the following:
>
> document.all['first'].style.backgroundColor = '#XXXXXX'
>
> where XXXXXX is the RGB triplet of the color you want (or use the color
> name).
>
> Generally, the rule for styles that are hyphonated is to remove the
> hyphone and then capitalize the second (and subsequent) words, so
>
> font-weight
>
> becomes
>
> fontWeight
>
> in Javascript.
>
> Hope this helps.
>
> Julian.
>
>
>> Hi,
>> I'm having a bit of a problem with some styles applied to a <td> tag.
>>
>> I've assigned the tag like this:
>> <td id="first" width="16" style="background-color:black">
>>
>> What I want to be able to do is reference "first" and change the
>> background-color - to white say.
>>
>> If I do:
>> alert(first.style);
>>
>> I get:
>> [object style] in IE
>>
>> and
>>
>> "first is not defined" in NN
>>
>> If I do:
>> alert(first.style.background-color);
>>
>> I get:
>> "color is undefined" in IE
>>
>> and again
>>
>> "first is not defined" in NN
>>
>>
>> How do I reference this property?
>> How do I change this property?
>>
>> Thanks in advance,
>> Luke 8-D
>>
>
>
Thanks for the advice, looks like I'm going to layer heaven!
8-D
Luke