Accessing CSS settings(vars)

liunx

Guest
Is is possible to access a setting such as Object.style.top if you set that setting in the CSS(external)?

For instance:


.aClass
{
position: absolute;
top: 400px;
}

Is it possible to get the Object.style.top from the webpage or external js file if that setting is set in the css and not the style="" part of the object?I believe you would be looking for Object.offsetTop.

Or if you need the distance of it from the top-margin (<!-- m --><a class="postlink" href="http://javascript.internet.com/snippets/getposition.html">http://javascript.internet.com/snippets ... ition.html</a><!-- m -->)

function getPositionTop(This){
var el = This;var pT = 0;
while(el){pT+=el.offsetTop;el=el.offsetParent;}
return pT
}http://www.quirksmode.org/dom/getstyles.htmlThank you both.
 
Back
Top