title: Javascript - Get checkbox values from a form and get a random result
body: <p>I have a form that allows multiple checkbox. I want to get a random value of all <strong>checked items</strong> when the "Generate" button is pressed.</p>
  
  <p>On the one hand I have the form:</p>
  
  <pre><code>&lt;FORM NAME="testform"&gt;
  &lt;INPUT CLASS="cities" TYPE="checkbox" NAME="mex" Value="mex"checked="checked"&gt;México&lt;BR&gt;
  &lt;p&gt;&lt;INPUT CLASS="cities" TYPE="checkbox" NAME="ita" Value="ita"&gt;Italy&lt;BR&gt;
  &lt;p&gt;&lt;INPUT CLASS="cities" TYPE="checkbox" NAME="usa" Value="usa"&gt;United State of America&lt;BR&gt;
  &lt;p&gt;&lt;INPUT TYPE="button" NAME="button" Value="Generate" 
  onClick="testButton"&gt;&lt;BR&gt;
  &lt;/FORM&gt;
  </code></pre>
  
  <p>But I am a novice in JavaScript and I need help building this exercise. </p>
  
  <p>By the other hand I have no idea how to get the form values. These are the random elements of each checkbox.</p>
  
  <pre><code>var mex=["mexico-df.html","veracruz.html","acapulco.html"]
  var ita=["roma.html","milan.html","venecia.html"]
  var usa=["los-angeles.html","new-york.html","washington.html"]
  </code></pre>
  
  <p>I want that if something check México and USA, for example, the result should be only one random value between those included in the above variables.</p>
  
  <p>I do not know exactly how to get the checked values from the form and how to pick a random value from only selected items.</p>
  
  <p>Do you have any suggestions for me?</p>
  
  <p>Sorry if my English is not so good.</p>