Home  >  Article  >  Web Front-end  >  JavaScript controls html elements to show/hide implementation code_javascript skills

JavaScript controls html elements to show/hide implementation code_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:47:251478browse
1. Write js function

2. Add the id attribute to the html element to be shown/hidden







3. Add buttons, links, etc. to trigger js functions
Show/Hide
javascript show hidden layer
Advertising

2: javascript control page Two methods for hiding and displaying controls
Two methods for JavaScript to control the hiding and displaying of page controls. The difference between the methods is whether the control still occupies space on the page after being hidden

Method 1: document.all["PanelSMS"].style.visibility="hidden";
document.all["PanelSMS"].style.visibility="visible";

Method 2 :
document.all["PanelSMS"].style.display="none"; document.all["PanelSMS"].style.display="inline"; Method 1 Hide The position of the back page is still occupied by the control, but it is not displayed Method 2: The position of the back page is not occupied by hiding it
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