Home >Web Front-end >JS Tutorial >js gets the position coordinates of the window relative to the left and top of the screen_javascript skills

js gets the position coordinates of the window relative to the left and top of the screen_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:48:081409browse

Get the position of the window relative to the left and top of the screen:

Copy code The code is as follows:

var x=window.screenLeft?window.screenLeft: window.screenX ;
var y=window.screenTop?window.screenTop: window.screenY;
alert(x " " y);
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn