Home >Web Front-end >JS Tutorial >Introduction to two methods of js controlling the hiding and display of page controls_javascript skills

Introduction to two methods of js controlling the hiding and display of page controls_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:20:43989browse

There are two ways to use JavaScript to control the hiding and display of page controls. The difference between the methods is whether the control still occupies space on the page after being hidden.
Method 1:

Copy code The code is as follows:

document.all["panelsms"].style.visibility="hidden";
document.all["panelsms"]. style.visibility="visible";

Method 2:
Copy code The code is as follows:

document.all["panelsms"].style.display="none";
document.all["panelsms"].style.display="inline";

After method one is hidden, the position of the page is still occupied by the control, but it is not displayed. Display=static is similar to the .net verification control.
After method two is hidden, the position of the page is not occupied. It is similar to the display= of the .net verification control. dynamic
Statement:
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