你屏幕上有根毛(恶搞JS代码)

Gcn
Gcn
2026-02-11 / 0 评论 / 3 阅读 / 正在检测是否收录...

页面中引入js通常大家最为熟悉的是以下两种方法:

在页面中直接写入

在页面中引入外部文件

<script>
!function() {
    var bottom = Math.floor(60 * Math.random()),
        right = Math.floor(50 * Math.random()),
        rotate = Math.floor(360 * Math.random());
    var foolsEgg = document.createElement("img");
    foolsEgg.src = "https://d.tiansj.net/other/js_ku/img/mao.png";
    foolsEgg.style.position = "fixed"; 
    foolsEgg.style.bottom = "".concat(bottom, "%");
    foolsEgg.style.right = "".concat(right, "%"); 
    foolsEgg.style.zIndex = "9999"; 
    foolsEgg.style.pointerEvents = "none";
    foolsEgg.style.width = "40%";
    foolsEgg.style.maxWidth = "190px";
    foolsEgg.style.transform = "".concat("rotate(", rotate, "deg)"); 
    document.body.append(foolsEgg);
} ();
</script>
0

评论 (0)

取消