A quick google gives me this for looking up an element's left and top properties:
========
function getElementLeft(Elem) {
if (ns4) {
var elem = getObjNN4(document, Elem);
return elem.pageX;
} else {
var elem;
if(document.getElementById) {
var elem = document.getElementById(Elem);
} else if (document.all){
var elem = document.all[Elem];
}
xPos = elem.offsetLeft;
tempEl = elem.offsetParent;
while (tempEl != null) {
xPos += tempEl.offsetLeft;
tempEl = tempEl.offsetParent;
}
return xPos;
}
}
function getElementTop(Elem) {
if (ns4) {
var elem = getObjNN4(document, Elem);
return elem.pageY;
} else {
if(document.getElementById) {
var elem = document.getElementById(Elem);
} else if (document.all) {
var elem = document.all[Elem];
}
yPos = elem.offsetTop;
tempEl = elem.offsetParent;
while (tempEl != null) {
yPos += tempEl.offsetTop;
tempEl = tempEl.offsetParent;
}
return yPos;
}
}
======
After that, you can set another element's position like so:
======
document.getElementById("movetext").style.left = pos1;
document.getElementById("movetext").style.top = pos2;