是否可以使用CSS或Javascript将光标隐藏在网页中?

编程入门 行业动态 更新时间:2024-10-24 13:29:23
本文介绍了是否可以使用CSS或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 属性:

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>

如果您要在全身设置:

<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.

更多推荐

是否可以使用CSS或Javascript将光标隐藏在网页中?

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

发布评论

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

>www.elefans.com

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