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.