This may seem like an idiotic question, but its been driving me mad for about an hour and half now. Im trying to find the document.getElementById("divaa").style.top
for an element, but all i ever get is " " returned, except with div's that don't have position:absolute; top:100; left:100 ...etc designated in their style class's. I dont know what the hell is going on and its driving me crazy
some examples of code:
var seop = gettopnum("divaa");
/ this works if i pass the "movera" div, but not the "divaa" div. the only difference between the two that i could see is that one has its top style defined within the style sheet and the other not. /
function gettopnum(gods)
{
var god = document.getElementById(gods);
var ctop = god.style.top;
alert(ctop); //at which ctop is returned as being " "
var tt = ctop.indexOf('p');
ctop = ctop.substr(0, tt);
ctop = Number(ctop);
return ctop;
}