Change CSS style display value from block to none in Javascript - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Style

Description

Change CSS style display value from block to none in Javascript

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body> 
      <input type="button" onmousedown="show()" onmouseup="hide()" <p id="elem">
      Some text here.Some text here.Some text here.Some text here.Some text here.
      <p></p>
       value="Toggle"&gt; 
      <script>
    function show() {//from  w  w  w.  ja va 2  s  . com
        var elem = document.getElementById('elem');
        elem.style.display = 'block';
    }
    function hide() {
        var elem = document.getElementById('elem');
        elem.style.display = 'none';
    }
    
      </script>  
   </body>
</html>

Related Tutorials