国产宅男网站在线|亚洲A级性爱免费视频|亚洲中精品级在线|午夜福利AA毛

  • <dd id="gf5jf"><th id="gf5jf"></th></dd>

    <cite id="gf5jf"><label id="gf5jf"></label></cite>
  • <div id="gf5jf"><listing id="gf5jf"></listing></div>
    學習啦>學習電腦>電腦硬件知識>鍵盤鼠標>

    jS獲取鼠標坐標、獲取鼠標像素點

    時間: 沈迪豪908 分享

      學前端的同學們你們知道怎么通過jS獲取鼠標坐標、獲取鼠標像素點嗎?下面是學習啦小編收集整理關于通過jS獲取鼠標坐標、獲取鼠標像素點嗎的資料以供大家參考學習,希望大家喜歡。

      JS獲取鼠標坐標,獲取鼠標像素點的典型實例

      <!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>JavaScript獲取鼠標坐標</title>

      <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

      <style type="text/css">

      .tip {

      width:200px;

      border:2px solid #ddd;

      padding:8px;

      background:#f1f1f1;

      color:#666;

      }

      </style>

      <script type="text/javascript">

      function mousePos(e){

      var x,y;

      var e = e||window.event;

      return {

      x:e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,

      y:e.clientY+document.body.scrollTop+document.documentElement.scrollTop

      };

      };

      function test(e){

      document.getElementById("mjs").innerHTML = mousePos(e).x+','+mousePos(e).y;

      };

      </script>

      </head>

      <body>

      <div id="mjs" class="tip">源碼愛好者</div>

      <div id="test" style="width:1000px;height:1000px;background:#ccc;" onmousemove="test(event)"></div>

      </body>

      </html>

    jS獲取鼠標坐標、獲取鼠標像素點相關文章:

    1.js設置鼠標光標形狀

    2.js實現(xiàn)鼠標移到圖片顯示文字

    3.使用js實現(xiàn)鼠標點擊變色

    1948890