From: nick on
On Apr 17, 8:53 pm, MikeJ <no_spam_ple...(a)nothere.com> wrote:
> I find that if I try to read a style sheet attrib. with javascript
> (such as document.getElementById("myTabl").style.left;) it returns
> nothing. If I set the value in javascript first then I can read it.
>
> Is there some way around this. The CSS is setting it but I can't read
> it until I have set it in javascript.
>
> Thanks
> Mike

Use window.getComputedStyle() or <element>.currentStyle() for IE.

http://www.quirksmode.org/dom/getstyles.html

-- Nick
From: MikeJ on
Thanks.
There is no standard way (other than going through javascript to set
them) to initialize them?

On Sat, 17 Apr 2010 18:07:19 -0700 (PDT), nick <nick___(a)fastmail.fm>
wrote:

>On Apr 17, 8:53�pm, MikeJ <no_spam_ple...(a)nothere.com> wrote:
>> I find that if I try to read a style sheet attrib. with javascript
>> (such as document.getElementById("myTabl").style.left;) it returns
>> nothing. If I set the value in javascript first then I can read it.
>>
>> Is there some way around this. The CSS is setting it but I can't read
>> it until I have set it in javascript.
>>
>> Thanks
>> Mike
>
>Use window.getComputedStyle() or <element>.currentStyle() for IE.
>
>http://www.quirksmode.org/dom/getstyles.html
>
>-- Nick

From: nick on
On Apr 17, 9:15 pm, MikeJ <no_spam_ple...(a)nothere.com> wrote:
> Thanks.
> There is no standard way (other than going through javascript to set
> them) to initialize them?

I think they'll show up in the <element>.style collection if you set
them in an element's style attribute, i.e. 'inline.'
From: MikeJ on
OK. I see. Just to be sure. Inline styles are compatible with all
browsers right ( I am sure pretty much but wanted to see)?



On Sat, 17 Apr 2010 18:25:29 -0700 (PDT), nick <nick___(a)fastmail.fm>
wrote:

>On Apr 17, 9:15�pm, MikeJ <no_spam_ple...(a)nothere.com> wrote:
>> Thanks.
>> There is no standard way (other than going through javascript to set
>> them) to initialize them?
>
>I think they'll show up in the <element>.style collection if you set
>them in an element's style attribute, i.e. 'inline.'

From: Garrett Smith on
MikeJ wrote:
[posting order restored - see:<
http://en.wikipedia.org/wiki/Posting_style#Interleaved_style>]

>
>
> On Sat, 17 Apr 2010 18:25:29 -0700 (PDT), nick <nick___(a)fastmail.fm>
> wrote:
>
>> On Apr 17, 9:15 pm, MikeJ <no_spam_ple...(a)nothere.com> wrote:
>>> Thanks.
>>> There is no standard way (other than going through javascript to set
>>> them) to initialize them?
>> I think they'll show up in the <element>.style collection if you set
>> them in an element's style attribute, i.e. 'inline.'
>
> OK. I see. Just to be sure. Inline styles are compatible with all
> browsers right ( I am sure pretty much but wanted to see)?
>

No, but you'll have trouble finding a modern browser that doesn't
support that.

See DOM 2 Style. Specifically, look for `ElementCSSInlineStyle`.

<http://jibbering.com/faq/#domResources>
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/