Hi dear web people,
DHTML's DOM document.getElementById("id").attributes gives me array of
HTML attributes written inside html. document.
How could i get those defined in CSS file (e.g. margin, padding, width and
height) ?
Look at the style attribute for the element - also this is really a
javascript question and not an html one, try and ask in the right place
next time.
eg:
var idMarginStr = document.getElementById("id").style.margin;
var idPaddingStr = document.getElementById("id").style.padding;
var idWidthStr = document.getElementById("id").style.width;
var idHeightStr = document.getElementById("id").style.height;
(note these are all string values and may be any valid css for element
and css property, or an empty string if no style is set is set for the
element / property combination)
and
document.getElementById("id").style.margin = "10px 30px";
document.getElementById("id").style.padding = "1em";
document.getElementById("id").style.width = "600px";
document.getElementById("id").style.height = "400px";
Rgds
Denis McMahon