Change CSS with Javascript after a second with setTimeout timer - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window setTimeout

Description

Change CSS with Javascript after a second with setTimeout timer

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <div class="logindiv" style="display:none">
          This is login div 
      </div> 
      <script>
   setTimeout(myTimer, 1000);//w ww  .  j  av  a2  s  .  co  m
    function myTimer() {
        var elements = document.getElementsByClassName("logindiv");
        for(i=0;i<elements.length;i++){
           elements[i].style.display = "block";
        }
    }

      </script>  
   </body>
</html>

Related Tutorials