0

我想隐藏基于浏览器的游戏的光标。在比赛开始之前我不想这样做。

我在 CSS 中有这个:* { cursor: none }. 我将如何在 JavaScript 中执行此操作?我的目标浏览器是 Chrome,只有 Chrome。

4

2 回答 2

2

You can do

document.body.style.cursor='none';

A note about your CSS : it's better to avoid as much as possible the * selector, especially when you can just set a style to the body.

于 2013-02-22T12:25:51.510 回答
1
<div id="nocursor"></div>

<script type="text/javascript">
    document.getElementById('nocursor').style.cursor = 'none';
</script>

It still uses css, but I assume that this is what you were looking for.

于 2013-02-22T12:28:00.910 回答