Link to home
Start Free TrialLog in
Avatar of stminfo
stminfo

asked on

JavaScript – Getting Current Window Position

Using JavaScript I need to get the current window position.  For example I have the following html page:

--------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Sample App</title>

    <script language="javascript" type="text/javascript">
           
    function myOnClick()
    {
         var x;
         var y;
       
          // these are just dummy values, I need to get the actual window position
          x = 1;
          y = 2;

           // Report the results
           alert("Window is at " + x + ", " + y);  
     }    
   
     </script>

</head>
<body onclick="myOnClick()">
    <div>This is my App!</div>
</body>
</html>

--------------------------------------------------------

In the function myOnClick  I would like to assign the current window position to the variables x and y.  I am using Microsoft Internet Explorer 6.0.  Anybody have any suggestions?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of vinlnx
vinlnx

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stminfo
stminfo

ASKER

Works great, thanks!