Get the position of the window relative to the left and upper side of the screen: The code copy is as follows: var x=window.screenLeft?window.screenLeft: window.screenX ; var y=window.screenTop?window.screenTop: window.screenY; alert(x+" "+y);