'display' Example : display « CSS « HTML / CSS






'display' Example

  
    
<html>
<head>
<style>
.style1 { 
    display:none 
}
</style>
<script language="JavaScript">
function function1() {
    item1.style.display="";
    item2.style.display="none";
    item3.style.display="none";
    }
function function2() {
    item1.style.display="none";
    item2.style.display="";
    item3.style.display="none";
    }
function function3() {
    item1.style.display="none";
    item2.style.display="none";
    item3.style.display="";
    } 
function function5() {
    item1.style.display="";
    item2.style.display="";
    item3.style.display="";
    }
function function6() {
    item1_1.style.visibility="visible";
    item2_1.style.visibility="visible";
    item3_1.style.visibility="visible";
    }
</script>
</head>
<body>
<table cellspacing=5 cellpadding=5 border=2>
    <tr>
       <th>header 1</th>
       <th>header 2</th>
       <th>Header 3</th>
    </tr>   
    <tr id="item1">
       <td>Cars</td>
       <td id="item1_1">item 1</td>
       <td>item 2</td>
    </tr>
    <tr id="item2">
       <td>item 3</td>
       <td id="item2_1">item 4</td>
       <td>High</td>
    </tr>
    <tr id="item3">
       <td>item 5</td>
       <td id="item3_1">item 6</td>
       <td>Slow</td>
    </tr>
</table>
<p>
<input type=button style="width:175" onclick="function1()" value="Show some ">
<input type=button style="width:175" onclick="function2()" value="Show some other">
<input type=button style="width:175" onclick="function3()" value="Show some other else">
<input type=button style="width:175" onclick="function6();function5()" value="Reset">
<ul>
    <li onclick="className='style1'">Item 1 ? Double-click me</li>
    <li onclick="className='style1'">Item 2</li>
    <li onclick="className='style1'">Item 3</li>
    <li onclick="className='style1'">Item 4</li>
    <li onclick="className='style1'">Item 5</li>
</ul>
</body>
</html>

    
      
        
    
  








Related examples in the same category

1.display: block
2.display: inline
3.display: none
4.Disappearing an element by using the display property
5.use display:none to prevent an element from being rendered.
6.use display:inline to render an element inline.
7.use display:block to render an element as a block
8.display: inline-block
9.display:list-item to render as list item
10.use display:inline-block to render an inline element as a block nested in a line.
11.Div toggler with Javascript
12.Rendered as a table with rows and cells