English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
screenXa read-only property that returns the horizontal distance from the left edge of the user's browser window to the left edge of the screen (in pixels).
The screenX property is a newerscreenLeftalias of the property.
window.screenX
var win = window.open("", "popupWindow"); win.document.write("<p>This is 'popupWindow'"); win.document.write("<br>ScreenX: " + win.screenX); win.document.write("<br>ScreenY: " + win.screenY + "</p>Test and See‹/›
Note: The screenX and screenY properties are equal to the screenLeft and screenTop properties.
All browsers fully support the screenX property:
property | |||||
screenX | is | is | is | is | is |
Return Value: | This number is equal to the number of CSS pixels from the left edge of the browser viewport to the left edge of the screen |
---|
Return the x and y coordinates of the new window relative to the screen:
var win = window.open("", "popupWindow", "left=500, top=350, width=300, height=200"); win.document.write("<p>This is 'popupWindow'"); win.document.write("<br>ScreenX: " + win.screenX); win.document.write("<br>ScreenY: " + win.screenY + "</p>Test and See‹/›
Reference: Window (Window)window.screenY property
Reference: Window (Window)window.screenTop property
Reference: Window (Window)window.screenLeft property