title: Take color as input and change the background and foreground color repeatedly till user clicks cancel button
body: <p>I have this question at hand: Prompt the user to enter his favorite background and foreground color. Receive the values and apply the same as the page’s background and foreground. Keep prompting the user for these details until the user says no(press cancel button).</p>
  
  <p>This is what I did so far:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
    &lt;title&gt;Color change&lt;/title&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
    &lt;p id="msg"&gt;Test sentence&lt;/p&gt;
    &lt;button onclick=myFunction()&gt;Input&lt;/button&gt;
    &lt;script&gt;
      function myFunction(){
  
        do{
          var a=prompt("Input backgroud color.","red");
          document.body.style.backgroundColor=a;
          var b=prompt("Input foreground color.","green");
          document.body.style.color=b;
        }while(a!="");
      }
  
    &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This code just keep asking for input and does not reflect any change in color. I want the color to be changed after each input till user clicks cancel.
  Any suggestion will be useful. Thanks.</p>