Thursday, 15 August 2013

javascript - Calculate height and width of HTML content -



javascript - Calculate height and width of HTML content -

i creating generic mywindow extending ext.window.window component. here need back upwards 1 feature auto adjust height , widht of window. height , width depend on height/width of html content within window. there way in ext js or javascrip can provide me height , width of html content.

to height or width of element in pixels (including padding , borders), utilize offsetheight , offsetwidth properties of object. these values readonly.

if have set style of element, can height , width (excluding padding , border) style property:

var el = document.getelementbyid('elementid'); var width = el.style.width; var height = el.style.height;

you can set height or width of element way.

el.style.width = 40 + 'px';

'px' can changed valid unit, e.g. em.

javascript extjs

No comments:

Post a Comment