Get width and height of element

Discussion in 'ASP .Net' started by Alejandro Penate-Diaz, May 2, 2005.

  1. 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.
     
    Alejandro Penate-Diaz, May 2, 2005
    #1
    1. Advertisements

  2. 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);
     
    Johan Nordberg, May 2, 2005
    #2
    1. Advertisements

  3. Alejandro Penate-Diaz

    Sambathraj Guest

    Sambathraj, May 2, 2005
    #3
  4. Alejandro Penate-Diaz

    suresh44t

    Joined:
    Jan 5, 2013
    Messages:
    1
    Likes Received:
    0
    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").innerWidth()+" px");
    $("div.outerWidth").append($("div.outerWidth").outerWidth()+" px");
    });
     
    suresh44t, Jan 5, 2013
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. AndrewF
    Replies:
    1
    Views:
    1,152
    Bruce Barker
    Oct 10, 2005
  2. Replies:
    14
    Views:
    14,387
  3. Lois
    Replies:
    1
    Views:
    4,558
    Ryan Stewart
    Dec 27, 2004
  4. cera
    Replies:
    1
    Views:
    1,750
    Neredbojias
    Aug 18, 2007
  5. Bernd Meier
    Replies:
    6
    Views:
    818
    GTalbot
    Jan 14, 2008
  6. Replies:
    12
    Views:
    531
  7. Dario de Judicibus

    width and height of an element

    Dario de Judicibus, Feb 4, 2004, in forum: Javascript
    Replies:
    0
    Views:
    267
    Dario de Judicibus
    Feb 4, 2004
  8. toffee
    Replies:
    3
    Views:
    316
    toffee
    Nov 27, 2006
Loading...