"禁用"一个带有Javascript的HTML表格 [英] "Disabling" an HTML table with Javascript

查看:100
本文介绍了"禁用"一个带有Javascript的HTML表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在很多网站上看到了这一点,但似乎无法跟踪其中一个。本质上,我想在点击按钮时禁用整个面板(即HTML表格中的表单)。



通过禁用,我的意思是我不想要表格中的表单元素可用,我希望表格可以淡出。



我已经能够通过将面纱表格中绝对定位的div具有低透明度的白色背景(所以你可以看到它后面的表格,但不能点击任何东西,因为div在它的前面)。这也增加了我想要的淡化效果。但是,当我将面纱的高度设置为100%时,它只能达到我的屏幕的大小(不包括滚动),所以如果用户向上或向下滚动,他们会看到面纱的边缘,这并不漂亮。

我假设这通常以不同的方式完成。有没有人有一些建议,作为一个更好的方式来实现这一目标?

解决方案

你难道不能找出该区域的高度像素与JavaScript?然后将面纱的高度设置为那个数字?



我的脑海中没有确切的代码,但是offsetHeight可能会做到这一点


I've seen this done in a lot of sites recently, but can't seem to track one down. Essentially I want to "disable" an entire panel (that's in the form on an HTML table) when a button is clicked.

By disable I mean I don't want the form elements within the table to be usable and I want the table to sort of fade out.

I've been able to accomplish this by putting a "veil" over the table with an absolutely positioned div that has a white background with a low opacity (so you can see the table behind it, but can't click anything because the div is in front of it). This also adds the faded effect that I want. However, when I set the height of the veil to 100% it only goes to the size of my screen (not including the scrolling), so if a user scrolls up or down, they see the edge of the veil and that's not pretty.

I'm assuming this is typically done in a different fashion. Does anyone have some suggestions as a better way to accomplish this?

解决方案

Can't you just find out the height of the area in pixels with JavaScript? And then set the veil's height to that number?

I don't have the exact code in my head but offsetHeight might do the trick

这篇关于"禁用"一个带有Javascript的HTML表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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