Home >Web Front-end >JS Tutorial >Two ways to control the hidden appearance of js containers to prevent style changes_javascript skills

Two ways to control the hidden appearance of js containers to prevent style changes_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:51:031147browse

Method 1:

Copy code The code is as follows:

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

Method 2:
Copy code The code is as follows:

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

After method one is hidden, the position of the page is still occupied by the control, but the Display similar to the .net verification control is not displayed. =Static
Method 2: The position of the page after hiding is not occupied, similar to Display=Dynamic of .net validation control
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