Home > Web Front-end > JS Tutorial > body text

js控制容器隐藏出现防止样式变化的两种方法_javascript技巧

WBOY
Release: 2016-05-16 16:51:03
Original
1063 people have browsed it

方法一:

复制代码 代码如下:

document.getElementById("控件ID").style.visibility="hidden";
document.getElementById("控件ID").style.visibility="visible";

方法二:
复制代码 代码如下:

document.getElementById("控件ID").style.display="none";
document.getElementById("控件ID").style.display="inline";

方法一隐藏后 页面的位置还被控件占用 只是不显示 类似于.net验证控件的Display=Static
方法二隐藏后 页面的位置不被占用 类似于.net验证控件的Display=Dynamic
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!