1. Get the inline style of the element
var obj = document.getElementById("test");
alert(obj.height "n" obj.width);
// 200px 200px typeof=string just displays the value in the style attribute
2. Get the calculated style
var obj = document.getElementById("test");
var style = null;
if (window.getComputedStyle) {
Style = window.getComputedStyle(obj, null); // Non-IE
} else {
Style = obj.currentStyle; // IE
}
alert("width=" style.width "nheight=" style.height);
Note: If the width and height of the element are not set, the default width and height will be returned in non-IE browsers. Return auto string
under IE
3. Get the styles written in the and