title: changing text after regular interval
body: <p>I want to write a code that takes up a paragraph  and the contents of the paragraph are changed at certain intervals say 5 seconds.the contents should alternate at every 5 seconds. using javascript.here is my attempt.</p>
  
  <pre><code>&lt;html&gt;
  &lt;script&gt;
      i = 0;
  
      function changeText(txt) {
              var s = txt;
              document.body.innerHTML.change = document.body.innerHTML.replace(s, Mudit ");
                  replaceorig(txt); i++;
                  if (i % 2 == 0) setTimeOut(function() {
                      changeText();
                  }, 500);
              }
  
              function replaceorig(txt) {
                  document.body.innerHTML.change = txt;
              }
  &lt;/script&gt;
  
  &lt;body onload="changeText('My name is Mudit')" ;&gt;
      &lt;p id="change"&gt;My name is Mudit&lt;/p&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>