Two ways to hide and display JS settings control

Source: Internet
Author: User

JS to set the control to hide and display, set the control style display and visibility properties on it, there is an example, the need for friends can refer to the following
There are two ways to hide a control with JavaScript, respectively, by setting the display and visibility properties of the control's style.
Controls are not visible when style.display= "block" or style.visibility= "visible" or when style.display= "none" or style.visibility= "hidden". The difference is that "display" hides the control, and the hidden control no longer occupies the display, while the "visibility" hidden control simply sets the control to invisible, and the control still occupies its original position.

functionDisplayhideui () {varUI =document.getelementbyid ("BBS"); Ui.style.display= "None"; } functionDisplayshowui () {varUI =document.getelementbyid ("BBS"); Ui.style.display= "";//If display is empty, the block will wrap the space behind it.functionVisibilityhideui () {varUI =document.getelementbyid ("BBS"); Ui.style.visibility= "Hidden"; } functionVisibilityshowui () {varUI =document.getelementbyid ("BBS"); ui.style.visibility= "Visible"; } 

Two ways to hide and display JS settings control

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.