首页 小组 问答 话题 好文 素材 用户 唠叨 我的社区

[代码]html炫酷彩虹鼠标拖尾

九秘Lv.1种子选手
2024-09-29 22:47:43
0
24


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
            position: absolute;
        }
    </style>
</head>
<body>
    <script>
        document.documentElement.onmousemove = function (eve) {
            var ev = window.eve || eve
            var div = document.createElement("div")
            console.log(div)
            div.style.left = ev.clientX + "Px"
            div.style.top = ev.clientY + "Px"
            var r = Math.floor(Math.random() * (255 - 0 + 1) + 0)
            var g = Math.floor(Math.random() * (255 - 0 + 1) + 0)
            var b = Math.floor(Math.random() * (255 - 0 + 1) + 0)
            div.style.backgroundColor = "rgb(" + r + "," + g + "," + b + ")"
            document.body.appendChild(div)
        }
    </script>
</body>
九秘
九秘

13 天前

签名 : 我常驻在>https://www.huaqu.club/ask   24       0
评论
站长交流