Mark
asked on
Can I get a string of all style attributes?
I know I can get specific style attributes: document.getElementById('b cs').style .width, for example. Is there a way I can get all the attributes settings in a single string without having to specify each one? I'd like to either specify and element, or perhaps be able to specify the css class, I don't care which.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Style, as you can see, is a MASSIVE object.
Each browser will have a different list also.
In FireFox I got 189 elements. Ok a few are duff, but still, a LOT.
If you only want a few, then maybe something like (again prototype.js) ...
$W('font color weight decoration height border margin padding').each(....)
Each browser will have a different list also.
In FireFox I got 189 elements. Ok a few are duff, but still, a LOT.
If you only want a few, then maybe something like (again prototype.js) ...
$W('font color weight decoration height border margin padding').each(....)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That will only retrieve the style attribute for the element, not the element's style. Very different things.
If the style is defined via CSS, then attr('style') won't work.
The prototype's route woult be ...
$('test').readAttribute('s tyle');
If the style is defined via CSS, then attr('style') won't work.
The prototype's route woult be ...
$('test').readAttribute('s
of course you're right, my mistake :)
ASKER
Thanks guys, but I think I'll pass on using prototype or jquery. For now, I just use explicitly query the attributes I want.
ASKER