zoukankan      html  css  js  c++  java
  • 获取鼠标点击的坐标处理

    1.编写js :

     function whichElement(e)
        {
            x=e.x
            y=e.y
            m = document.getElementById('GV_Car');
            var h = 0;
            while(m.offsetParent)
            {
             h += m.offsetTop;
             m = m.offsetParent;
            }
            m = document.getElementById('div_info');
            var t = 0;
            while(m.offsetParent)
            {
             t += m.offsetTop;
             m = m.offsetParent;
            }
            var yy = document.getElementById('txt_YY').value;
            if (y > 74)
            {
                if (h <= y && y < t)
                {
                    document.getElementById('txt_YY').value = "1";
                }
                else
                {
                    document.getElementById('txt_YY').value = "0";              
                }
            }     
        }

    2. 调用js:

    <body onmousedown="whichElement(event)">

  • 相关阅读:
    sql中添加唯一索引(非主键)
    Ubuntu 安装 LAMP 主机之后运行出现乱码
    编写安全 PHP 应用程序的七个习惯
    首先在服务器上安装ssh的服务器端
    php安全简析
    正确的Linux菱形乱码修改方法
    php安全
    变量作用域
    bind9 详细解析
    DNS和DHCP服务器
  • 原文地址:https://www.cnblogs.com/shinggang/p/1999525.html
Copyright © 2011-2022 走看看