Change text content every day with javascript - Javascript Date Operation

Javascript examples for Date Operation:Day

Description

Change text content every day with javascript

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*from   w ww .ja v a  2  s . c o m*/
var d = new Date().getDay();
var titles = ['title 1', 'title 2', 'title 3', 'title 4', 'title 5', 'title 6', 'title 7'];
document.getElementById("title").innerHTML = titles[d-1];
    }

      </script> 
   </head> 
   <body> 
      <div id="title"> 
      </div>  
   </body>
</html>

Related Tutorials