简体   繁体   English

我们可以使用JavaScript在Alertbox上禁用光标

[英]can we disable cursor on alertbox using javascript

I want to disable cursor pointer when my alert box will appear. 我想在出现警报框时禁用光标指针。 How can I do that with the help of JavaScript? 如何在JavaScript的帮助下做到这一点?

<script>
    function showalertbox(){
        alert('dfsdfdfs');  
        document.body.style.cursor = 'none';
     }
     showalertbox();
</script>

The alert and confirm boxes are notoriously uncustomizable (in other words, no, you can't do that). 众所周知,警报和确认框是无法自定义的(换句话说,不,您不能这样做)。 This is because they are hard-wired into the browser code, and therefore not part of the DOM. 这是因为它们被硬连接到浏览器代码中,因此不是DOM的一部分。 If you want to customize your alert boxes, consider using one of the many plugins for dialog boxes that are available. 如果要自定义警报框,请考虑使用许多可用的对话框插件之一。 However, if you do that, you will create complications due to the asynchronous nature of javascript, especially if you are wanting to emulate the confirm box. 但是,如果这样做,由于javascript的异步特性,会造成复杂性,尤其是当您要模拟确认框时。 You'll need to work out how to handle async callbacks. 您需要确定如何处理异步回调。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM