Change Body Color (Every 5 Seconds)

By Developgram - April 18, 2017

<html>
<body>
  <script>
    function violet()
    {
      document.body.style.background = "violet"
      setTimeout("indigo()", 5000);
    }

    function indigo()
    {
      document.body.style.background = "indigo"
      setTimeout("blue()", 5000);
    }

    function blue()
    {
      document.body.style.background = "blue"
      setTimeout("green()", 5000);
    }

    function green()
    {
      document.body.style.background = "green"
      setTimeout("yellow()", 5000);
    }

    function yellow()
    {
      document.body.style.background = "yellow"
      setTimeout("orange()", 5000);
    }

    function orange()
    {
      document.body.style.background = "orange"
      setTimeout("red()", 5000);
    }

    function red()
    {
      document.body.style.background = "red"
      setTimeout("violet()", 5000);
    }

    violet();
  </script>
</body>
</html>

  • Share:

You Might Also Like

0 comments