G
Guest
Determining default style properties
I know that one can use JS to determine various properties of the DOM.
E.g., suppose one has:
<p id='qwe' style="color:green">filler</p>
then
something= document.getElementById("qwe").style.color
returns 'green'.
But if one has
<style> .setcolor {colorink} </style>
<p id='qwe' class='setcolor'>filler</p>
something= document.getElementById("qwe").style.color
gets an empty string rather that the set color of 'pink'.
Similarly, one does not get any information about the browser's default
setting or any other setting given indirectly.
I have tried going up a level with
document.getElementById("qwe").parentNode.style.color
but that does not help. Nor does using
document.getElementById("qwe")getAttribute("style")
do any better in FireFox and in IE it just returns [object]
Surely that information must be there for the browser use it. Is it
accessible in any practical way?
One could, of course, set everything at the topmost level of <body> but
that would override the user's default settings which is most undesirable
(and rude).
TIA
I know that one can use JS to determine various properties of the DOM.
E.g., suppose one has:
<p id='qwe' style="color:green">filler</p>
then
something= document.getElementById("qwe").style.color
returns 'green'.
But if one has
<style> .setcolor {colorink} </style>
<p id='qwe' class='setcolor'>filler</p>
something= document.getElementById("qwe").style.color
gets an empty string rather that the set color of 'pink'.
Similarly, one does not get any information about the browser's default
setting or any other setting given indirectly.
I have tried going up a level with
document.getElementById("qwe").parentNode.style.color
but that does not help. Nor does using
document.getElementById("qwe")getAttribute("style")
do any better in FireFox and in IE it just returns [object]
Surely that information must be there for the browser use it. Is it
accessible in any practical way?
One could, of course, set everything at the topmost level of <body> but
that would override the user's default settings which is most undesirable
(and rude).
TIA