www.webdeveloper.com
Results 1 to 2 of 2

Thread: Get div's top class-property value

  1. #1
    Join Date
    May 2009
    Posts
    1

    Get div's top class-property value

    What i am trying to do, in theory is fairly simple. I have a div:

    Code:
    #MyDiv {
    	top:13px;
    }
    And i simply need to get the value of top...i had assumed something like
    Code:
    top = parseInt(document.getElementById("MyDiv").style.top);
    would work but it doesnt seem to

    Any help is much appreciated - im sure its something simple.

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    W3c complient:
    top = document.defaultView.getComputedStyle(document.getElementById('MyDiv'), null).top
    IE:
    top = document.getElementById('MyDiv').currentStyle.top
    At least 98% of internet users' DNA is identical to that of chimpanzees

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