是否可以使用CSS或Javascript将光标隐藏在网页中?(Is it possible to hide the cursor in a webpage using CSS or Javascrip

编程入门 行业动态 更新时间:2024-10-19 10:24:16
是否可以使用CSS或Javascript将光标隐藏在网页中?(Is it possible to hide the cursor in a webpage using CSS or Javascript?)

我想在显示一个旨在在建筑物大厅显示信息的网页时隐藏光标。 它不一定是互动的。 我试着用cursor属性和一个透明的光标图像,但我没有使它的工作。

有人知道这是否可以完成? 我想这可以被认为是一个安全威胁的用户,不知道他在哪里点击,所以我不是很乐观...谢谢!

I want to hide the cursor when showing a webpage that is meant to display information in a building hall. It doesn't have to be interactive at all. I tried with the cursor property and a transparent cursor image but I didn't make it work.

Does anybody know if this can be done? I suppose this can be thought as a security threat for a user that can't know where he is clicking on, so I'm not very optimistic... Thank you!

最满意答案

使用CSS:

selector { cursor: none; }

一个例子:

<div class="nocursor"> <!-- some stuff --> </div> <style type="text/css"> .nocursor { cursor:none; } </style>

要在Javascript中的元素上设置,可以使用style属性:

<div id="nocursor"><!-- some stuff --></div> <script type="text/javascript"> document.getElementById('nocursor').style.cursor = 'none'; </script>

如果要将其设置在全身上:

<script type="text/javascript"> document.body.style.cursor = 'none'; </script>

确保你真的想隐藏光标,但是。 真的可以让人烦恼

With CSS:

selector { cursor: none; }

An example:

<div class="nocursor"> <!-- some stuff --> </div> <style type="text/css"> .nocursor { cursor:none; } </style>

To set this on an element in Javascript, you can use the style property:

<div id="nocursor"><!-- some stuff --></div> <script type="text/javascript"> document.getElementById('nocursor').style.cursor = 'none'; </script>

If you want to set this on the whole body:

<script type="text/javascript"> document.body.style.cursor = 'none'; </script>

Make sure you really want to hide the cursor, though. It can really annoy people.

更多推荐

cursor,know,知道,电脑培训,计算机培训,IT培训"/> <meta name="description&qu

本文发布于:2023-04-29 10:21:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336347.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:光标   可以使用   网页   CSS   webpage

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!