<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
                #areaDiv {
                    border: 1px solid black;
                    width: 300px;
                    height: 50px;
                    margin-bottom: 10px;
                }
                
                #showMsg {
                    border: 1px solid black;
                    width: 300px;
                    height: 20px;
                }
        </style>
        
        <script type="text/javascript">
            window.onload = function(){
                document.querySelector("#areaDiv").onmousemove = function(event){
                    event = event || window.event;
                    
                    // 正常浏览器时传参获取event对象  IE8的even对象在window中所以使用 window.event
                    document.querySelector("#showMsg").innerHTML = "X: "+event.clientX+" Y: "+event.clientY;
                }
            }
        </script>
    </head>
    <body>
            <div id="areaDiv"></div>
            <div id="showMsg"></div>
    </body>
</html>