/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] capture dimensions of object

how do i capture the true width and height of an object (including borders, padding etc) using javascript? i know that object.style.height will give me the CSS height, but i want to know the overall dimensions…

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@mrhooJul 31.2007 — [CODE]function elSize(who){
return [Math.max(who.scrollWidth,who.offsetWidth),
Math.max(who.scrollHeight,who.offsetHeight)];
}[/CODE]
Copy linkTweet thisAlerts:
@bcamp1973authorJul 31.2007 — great! thanks to you both!
Copy linkTweet thisAlerts:
@bcamp1973authorJul 31.2007 — mrhoo, an you demonstrate how your function would be used? i'm not clear on the syntax of getting the returned value...
×

Success!

Help @bcamp1973 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...