if (!window.position) { window.position = function() { return (navigator.appName.toLowerCase().indexOf("explorer") >= 0) ? { x: window.screenLeft, y: window.screenTop } : { x: window.screenX, y: window.screenY }; }; }; $(function() { function showWinPos() { $("#valueX").text(window.position().x); $("#valueY").text(window.position().y); }; setInterval(function() { showWinPos(); }); });
<table> <thead> <tr> <th colspan="2" style="font-variant:small-caps;padding:1em;"> <p>Window Position</p> </th> </tr> <tr> <th style="border-right:1px solid;"> <p>X</p> </th> <th> <p>Y</p> </th> </tr> </thead> <tbody> <tr> <td> <p id="valueX"></p> </td> <td> <p id="valueY"></p> </td> </tr> </tbody> </table>
table { border-collapse: collapse; margin: 1em auto; } table, th, td, p { text-align: center; } th p { text-decoration: underline; } td { width: 50px; } td:first-child { border-right: 1px solid; } td p { background-color: #FFA; }