Guest cfican Posted September 4, 2009 Share Posted September 4, 2009 I'd like to be able to get the style.left value. I can set the left edge of an element with document.getElementById(obj).style.left = 15px how can I get the current value? Link to comment Share on other sites More sharing options...
Ingolme Posted September 4, 2009 Share Posted September 4, 2009 You can read the property: alert(document.getElementById(obj).style.left); Keep in mind that unless you've actually set the style attribute of the element, the property will be empty. It doesn't obtain the style that was given through the stylesheet.But rather than finding the style property, if you want to check the position use offsetLeft and offsetTop: alert(document.getElementById(obj).offsetLeft); Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.