title: Javascript checkboxes and random list outputting text rather than variable
body: <p>I am trying to make checkboxes page determine what choices are used in the frame.  The lists are just temporary for me to test and the alert(finalchoice) is also just for me to see what gets spit out at the end.  The problem is that, for example, var finalchoice ='choice0' rather than '<a href="http://www.nordstrom.com" rel="nofollow">http://www.nordstrom.com</a>'.
  I feel like this is a simple fix, but I can't figure it out.</p>
  
  <pre><code>function myfucntion(){
  var final_list = []     
  var checkboxes = document.getElementsByClassName('c');    
  for (var i = 0; i &lt; checkboxes.length; i++) {
  
          final_list = [];
          for (var i = 0; i &lt; checkboxes.length; i++) {
              if (checkboxes[i].checked) {
                  final_list.push(['choice'+i]);
  
  
              }
  
      };
  }
  
  list0  = ['http://www.nordstrom.com','http://www.nordstom.com'];    
  list1 = ['http://www.bing.com','http://www.bing.com'];
  list2 = ['http://www.yahoo.com','http://www.yahoo.com'];    
  list3 = ['http://www.amazon.com','http://www.amazon.com'];
  
  var choice0  = list1[Math.floor(Math.random()*list1.length)];
  var choice1  = list2[Math.floor(Math.random()*list2.length)];
  var choice2  = list3[Math.floor(Math.random()*list3.length)];
  var choice3  = list4[Math.floor(Math.random()*list4.length)];
  
  
  
  var finalchoice = final_list[Math.floor(Math.random()*final_list.length)];
  document.getElementById('window').src=finalchoice;
  alert(finalchoice)    
  }
  </code></pre>
  
  <p>Heres the html:</p>
  
  <pre><code>&lt;div&gt;
  &lt;button onclick="myfunction()"&gt;myfunction&lt;/button&gt;
  &lt;/div&gt;
  &lt;div&gt;
  &lt;input type="checkbox" class="c" /&gt;
  &lt;input type="checkbox" class="c" /&gt;
  &lt;input type="checkbox" class="c" /&gt;
  &lt;input type="checkbox" class="c" /&gt;
  &lt;/div&gt;
  &lt;iframe style="width:100%;height:500px" id="window" name="window" src=""&gt;
  &lt;/iframe&gt;
  </code></pre>