dxmfans
<!DOCTYPE html>


<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <script>
        onload = function () {
            var body = document.getElementsByTagName(\'body\')[0];
            var ps = document.getElementsByTagName(\'p\');
            var dv = document.createElement(\'div\');
            dv.style.width = \'100px\';
            dv.style.height = \'100px\';
            body.appendChild(dv);
            dv.style.display = \'none\';
            for (var i = 0; i < ps.length; i++) {
                ps[i].onmouseover = function (e) {
                    dv.style.position = \'absolute\';                    
                    dv.style.left = e.clientX + \'px\';
                    dv.style.top = e.clientY + \'px\';
                    dv.innerHTML = this.id;
                    dv.style.display = \'block\';



                };
                ps[i].onmouseout = function () {
                    dv.style.display = \'none\';
                }

            }
        }
    </script>
</head>
<body>
   <p id="1">1</p>
   <p id="2">2</p>
   <p id="3">3</p>
   <p id="4">4</p>
   <p id="5">5</p>
</body>
</html>

分类:

技术点:

相关文章:

  • 2021-11-23
  • 2021-11-13
  • 2021-11-05
  • 2021-11-05
  • 2021-11-23
  • 2021-06-14
  • 2021-11-11
  • 2022-01-01
猜你喜欢
  • 2021-11-23
  • 2021-12-05
  • 2021-05-06
  • 2021-12-19
  • 2021-11-03
  • 2021-11-05
相关资源
相似解决方案