如何在事件中禁用整个HTML页面(例如JavaScript警报)? [英] How can I disable an entire HTML page on an event like in the case of JavaScript alert?

查看:104
本文介绍了如何在事件中禁用整个HTML页面(例如JavaScript警报)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用JSP/HTML开发一个网页,在该网页中,我必须在按钮单击事件上禁用/灰屏"整个网页,以使最终用户无法访问该网页中的其他元素,除非禁用.

I am developing a web page in JSP/HTML in which I have to disable/ 'gray screen' an entire web page on a button click event so that an end user can't access the other element in web page until it's disabled.

我该怎么做?

推荐答案

CSS:

#cover {
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   opacity: 0.80;
   background: #aaa;
   z-index: 10;
   display: none;
}

HTML:

<body>
<div id="wrap">
 // your normal contents here
</div>
<div id="cover"> </div>
</body>

jquery:

//trigger on whatever event required.
$("#cover").fadeIn(100);
alert("something");
$("#cover").fadeOut(100); //after done.

这篇关于如何在事件中禁用整个HTML页面(例如JavaScript警报)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆