title: Button not calling function correctly
body: <p>I am trying to call a function on a button click, but for some reason the button will not call the function. Dreamweaver does not show any syntax errors. Can anyone tell me why the button is not working? </p>
  
  <pre><code>    &lt;html lang="en" xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;/head&gt;
     &lt;head&gt;
     &lt;title&gt;&lt;/title&gt;
  
  
  &lt;script type="text/javascript"&gt;
  
          var imgObj = 0;
          var imgObj1 = 0;
          var animate;
          var animate1;
  
          function init(){
             imgObj = document.getElementById('red');
             imgObj.style.position= 'relative';
             imgObj.style.left = '0px';
             imgObj1 = document.getElementById('blue');
             imgObj1.style.position = 'relative';
             imgObj1.style.left = '0px';
          }
  
          function moveRight(){
             imgObj.style.left = parseInt(imgObj.style.left = 0) + Math.floor((Math.random() * 100) + 1) + 'px';
  
             animate = setTimeout(moveRight(), 1000); 
             imgObj1.style.left = parseInt(imgObj1.style.left = 0) + Math.floor((Math.random() * 100) + 1) + 'px';
  
             animate1 = setTimeout(moveRight(), 1000); 
             if (imgObj.style.left &gt;= 1000px || imgObj1.style.left &gt;= 1000px)
              {
                  break;
                  else if
                  {
                      imgObj.style.left&gt;= 1000
                      MessageBox.show("The Red Car has won the Race!");
                  }
                  else
                  {
                      MessageBox.show("The Blue Car has won the Race!");
                  }
  
              }
          }           
  &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body onload = "init()"&gt;
  
     &lt;form&gt;
      &lt;input type="button" value="Start" onclick="moveRight()" /&gt;
      &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;
      &lt;img id="red" src="redcar.png" alt="Car 1"/&gt;
      &lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br&gt;
      &lt;img id="blue" src="bluecar.png" alt ="Car 2" /&gt;
  
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>