www.webdeveloper.com
Results 1 to 2 of 2

Thread: how to get form size

Hybrid View

  1. #1
    Join Date
    Jan 2013
    Posts
    1

    Cool how to get form size

    slt..
    I have a problem with js to clacul size of my body -- editor--

    expl :

    fonction getsize()
    {

    what .....

    }
    <form>
    <textarea>i love js </textarea>
    <botton onclick=getsize();>
    </form>


    tanks

  2. #2
    Join Date
    Mar 2009
    Posts
    464
    You need to be able to identify the element--try giving the element an id, such as "myTextArea".

    Code:
    function getSize(id){
        var el = document.getElementById(id);
        var width = el.offsetWidth;
        var height = el.offsetHeight;
        alert( "Width: " + width +"px  Height: " + height + "px");
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles