JQuery捕获网页鼠标点击和坐标

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type ="text/css" >
    .main{ background-color:Silver; width :100%; height :200px;}
    </style>
    <script src="js/ui/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        $(function () {
            $('#form1').live('mousedown', function (e) {
                //var x = e.originalEvent.x || e.originalEvent.layerX || 0; 
                //var y = e.originalEvent.y || e.originalEvent.layerY || 0; 
                var x = e.pageX; //当前鼠标所在的X轴位置
                var y = e.pageY; //当前鼠标所在的Y轴位置
                if (e.which == 1)
                    $('#divMain').append('<br/> left click;x:' + x + ',y:' + y);
                else if (e.which == 2)
                    $('#divMain').append('<br/> middle click;x:' + x + ',y:' + y);
                else if (e.which == 3)
                    $('#divMain').append('<br/> right click;x:' + x + ',y:' + y);
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id ="divMain" class ="main" >
           <%=ViewData["list"].ToString().ToDateTime()%>
    </div>
    </form>
</body>
</html>
原文地址:https://www.cnblogs.com/bingle/p/3091751.html