JS Operation CSS Property Implementation of the div layer spread off the effect of the method _javascript skills

Source: Internet
Author: User
Tags closure

This article describes the JS operation of CSS properties to achieve a div layer to expand the closure effect of the method. Share to everyone for your reference. The specific analysis is as follows:

Recently learned JavaScript contact to JS CSS properties of the operation, wrote a turn off effect, while implementing the button text switch, very concise Ah! This JS object to manipulate the CSS properties to achieve the expansion of the div layer closure effect. Share the code with the JS front-end designer.

<title>js Operation Div Expand close </title>
<style>
  #jb51 {border:solid 1px #EEE; 
    Background: #F7F7F7; 
    margin:20px; 
    padding:10px; 
    Display:none;
    width:300px;    
  }
</style>
<input style= "Cursor:pointer" onclick= "Show (' jb51 ');"
Type= ' button ' value= ' launches ' id= ' INP ' >
<div id= ' jb51 ' > Yun-Habitat Community provides programming source code, website source code, web material,
book tutorials, website templates, Web page special effects codes, etc. </div>
<script>
function Show (ID) {
  var aiin = document.getElementById (ID);
  var inp= document.getelementbyid (' InP ');
  if (aiin.style.display!= ' block ') {
    aiin.style.display = ' block ';
    Inp.value= ' close ';
  } else{
    aiin.style.display = ' none ';  
    inp.value= ' expand ';
  }
</script>

I hope this article will help you with your JavaScript programming.

Related Article

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.