You move the displayed position of the object by changing its upper and left margins, which together represent the coordinates of the upper left corner. If you know the absolute coordinates of the target position, you can change the fields and the object will move to this place.
If you donโt know the absolute target position, but only two relative deltas (i.e. move the window by 5 pixels and the right 10 pixels), you can read the upper and left fields of the object, increase their distances accordingly and set the fields for this.
Fields are part of the style of the object, so you can say something like:
theobject.style.left = 10 + 'px'; theobject.style.top = 40 + 'px';
for a positioned object.
source share