title: Trying to display a random video on page load
body: <p>I am trying to load a random video on page load. This is some javascript that I threw together that I thought might work. I'm not that familiar with javascript, so there might be a much easier way to do this... Any ideas?</p>
  
  <pre><code>function random_video {
  
      var string1 = '&lt;div class="span4"&gt;&lt;h3 class="meet"&gt;Meet the Makers&lt;/h3&gt;&lt;iframe width="100%" height="200" src="http://www.youtube.com/embed/Ig-DbfPoz3o" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;';
  
      var string2 = '&lt;div class="span4"&gt;&lt;h3 class="meet"&gt;Meet the Makers&lt;/h3&gt;&lt;iframe width="100%" height="200" src="http://www.youtube.com/embed/estPhyfBGho" frameborder="0" allowfullscreen=""&gt;&lt;/iframe&gt;&lt;/div&gt;';
  
      var string3 = '&lt;div class="span4"&gt;&lt;h3 class="meet"&gt;Meet the Makers&lt;/h3&gt;&lt;iframe width="100%" height="200" src="http://www.youtube.com/embed/6JL4hpnZklk" frameborder="0" allowfullscreen=""&gt;&lt;/iframe&gt;&lt;/div&gt;';
  
      var number = Math.floor((Math.random()*3)+1);
  
      if ( number == 1) {
        document.write(string1);
      } else ( number == 2 ) {
          document.write(string2);
      } else ( number == 3 ) {
          document.write(string3);
      }
  
  };
  </code></pre>