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

JavaScript controls html elements to show/hide implementation code_javascript skills

WBOY
Release: 2016-05-16 18:47:25
Original
1487 people have browsed it
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
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!