First of all, I'm not from an english-speaking country, so I'm sorry for any mistakes. If my english is not always understandable, please ask.
I got some divs with IDs which I position via css in an external file.
So I got something like this on the html-site:
<div id="i1" onclick="move(1)"></div>
In the css-sheet there ist something like this:
#i1 {position:absolute; left:193; top:47; height: 20; width: 20; background-color: #369e1c;}
Everything is positioned as I want it, but I want to read out the position of the div (to position something else), but getElementById somehow doesn't work. It all worked well, when the css was directly in the page, but it won't if it's in an external file.
Basically I do something like this:
function move(where){
var ids = "i" + where;
var newtop = document.getElementById(ids).style.left;
var newleft = document.getElementById(ids).style.left;
document.getElementById("playerred").style.left = newleft;
document.getElementById("playerred").style.top = newtop;
...
}
If I run firbug newtop and newleft is "", so somewhat empty.
Is there a way to read out the positioning otherwise?