function doPosition() { two.style.top = one.offsetHeight/2 - two.offsetHeight/2; two.style.left = one.offsetWidth/2 - two.offsetWidth/2; }