Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Get width and height of element

Reply
Thread Tools

Get width and height of element

 
 
Alejandro Penate-Diaz
Guest
Posts: n/a
 
      05-02-2005
Hi. Is there any way of getting an element real size from javascript, when
this element was previously assigned a width and height of 100%?
Thanks,
Alex.



 
Reply With Quote
 
 
 
 
Johan Nordberg
Guest
Posts: n/a
 
      05-02-2005
In IE you can use the getBoundingRect() method. Look ut up on MSDN for
documentation and examples. In most cases, you can use offsetHeight and
offsetWidth of the element, like

var e = document.getElementById("myDiv");
alert(e.offsetHeight);
alert(e.offsetWidth);

 
Reply With Quote
 
 
 
 
Sambathraj
Guest
Posts: n/a
 
      05-02-2005
Hi
You can use GetClientRects method. See
http://msdn.microsoft.com/library/de...lientrects.asp
Regards,
Sambathraj

"Alejandro Penate-Diaz" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi. Is there any way of getting an element real size from javascript, when
> this element was previously assigned a width and height of 100%?
> Thanks,
> Alex.
>
>
>



 
Reply With Quote
 
suresh44t suresh44t is offline
Junior Member
Join Date: Jan 2013
Posts: 1
 
      01-05-2013
Quote:
Originally Posted by Alejandro Penate-Diaz View Post
Hi. Is there any way of getting an element real size from javascript, when
this element was previously assigned a width and height of 100%?
Thanks,
Alex.
yes you can do this with the help of jQuery.


$(document).ready(function(){
$("div.width").append($("div.width").width()+" px");
$("div.innerWidth").append($("div.innerWidth").inn erWidth()+" px");
$("div.outerWidth").append($("div.outerWidth").out erWidth()+" px");
});
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why can't I change height with <col width="50" height="100">? Bernd Meier HTML 6 01-14-2008 07:25 AM
CSS question: Using height/width at 100% with fixed-width borders/margin/padding cera HTML 1 08-18-2007 02:59 AM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM
CSS min-width, max-width, and min-height with display:inline Lois HTML 1 12-27-2004 03:03 AM
width and height of an element Dario de Judicibus Javascript 0 02-04-2004 09:29 AM



Advertisments