title: how do i make a button generate a random number and each time the button is clicked a new number is generated and added to the previous number
body: <p>I need help making a button generate a random number in java script, i would like when the button is pressed for it to generate a random number between 1-10 and and then once the button is pressed again for it to generate a new random number but the sum of both number to show each time the button is presses. For example <em>button is presses and the computer generates 3 button is presses and computer generates 2 but shows the sum of 2+3 so 5</em></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
  
  &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
  &lt;link href='http://fonts.googleapis.com/css?family=Merienda+One' rel='stylesheet' type='text/css'&gt;
  
  
  &lt;title&gt;
      Blackjack
  &lt;/title&gt;
  
  &lt;body&gt;
  
  
      &lt;head&gt;
          &lt;h1&gt;
              &lt;i&gt;BLACKJACK&lt;/i&gt;
          &lt;/h1&gt;
          &lt;h4&gt;
              Computers Cards:
              &lt;input type="text" id="computerscards"&gt;
              &lt;br&gt;Player 1 cards:
              &lt;input type="text" id="playerscards"&gt;
          &lt;/h4&gt;
      &lt;/head&gt;
  
      &lt;input type="button" value="start" onclick="document.getElementById('playerscards').value = 
      random();document.getElementById('computerscards').value = 18"&gt;
  
  
      &lt;input type="button" value="deal" onclick="document.getElementById('playerscards).value = dealcard"&gt;
  
      &lt;input type="button" value="stand" onclick=""&gt;
  
      &lt;input type="button" value="next" onclick=""&gt;
  
  
      &lt;p&gt;Press hit if you would like to draw another card
          &lt;br&gt; press stand if you do not wish to draw another card
          &lt;br&gt; press next if you want to start the next round&lt;/p&gt;
  
  
  &lt;/body&gt;
  
  &lt;script src="java.js"&gt;&lt;/script&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>JAVASCRIPT</p>
  
  <pre><code>var total = 
  var randomnumber = Math.floor(Math.random() * 10 + 1); 
  
  function random() { 
      return randomnumber; 
  } 
  
  function dealcard() { } 
  </code></pre>