title: Javascript random number and background change from button
body: <p>I am having trouble. I am looking to press a button and have a random number return into a text box. If the number is even I want to change the background color to Red, and if its odd I want to change the background color to black. I have it almost working,but it does not continue to change the background color when I keep pressing the button, it only does the first. Here is my code. Any help would be appreciated.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  function BackgroundEven(){
  document.body.style.backgroundColor="#DA0505";
  }
  function BackgroundOdd(){
  document.body.style.backgroundColor="#000000";
  }
  
  function Random() {
  
  return Math.floor(Math.random()*37);
  }
  
  var rando= Random();
  function Change(){
  if(rando%2 == 0)
  {
  BackgroundEven();
  } 
  else{
  BackgroundOdd();
  }
  }
  }
  
  &lt;/script&gt;
  
  &lt;input type="text" name="Result" value="" id="Random" size="5"/&gt;
  &lt;input type="button" value="Spin" onclick="document.getElementById('Random').value=Random();Change();" /&gt;
  &lt;/input&gt;
  </code></pre>