Javascript Browser Window screenX and screenY Property get

Introduction

Open a new window with a specified left and top position, and return its coordinates:

View in separate window

<!DOCTYPE html>
<html>
<head>
<script>
function myFunction() {//  w w  w. j  a  v a  2 s .  co  m
  var myWindow = window.open("", "myWin", "left=700, top=350, width=200, height=100");
  myWindow.document.write("<p>This is 'myWin'");
  myWindow.document.write("<br>ScreenX: " + myWindow.screenX);
  myWindow.document.write("<br>ScreenY: " + myWindow.screenY + "</p>");
}
</script>
</head>
<body>

<button onclick="myFunction()">Open "myWin"</button>

</body>
</html>



PreviousNext

Related