Use document.write to output string - Javascript DOM

Javascript examples for DOM:Document write

Description

Use document.write to output string

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script>
            var Christmas = new Date ("December, 25, 2017");
            var toDay = new Date ();
            var then = Christmas.getTime();
            var now = toDay.getTime();
            var diff = (then-now)/(1000*60*60*24);
            document.write( " [Note: Get ready... There are only " + Math.round(diff) + " days until Christmas!] " );
        //from www.jav  a  2  s. com
      </script> 
      <title>abc</title> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials