title: set the width of an embedded youtube video
body: <p>I have created a custom made videogallery of my own. It can display html5 videos and youtube videos. The videos load dynamically , depending on what user clicked.</p>
  
  <p>At first I have</p>
  
  <pre><code>var elemv = document.createElement("video");
  elemv.setAttribute("width", "70%");
  elemv.setAttribute("controls", "true");
  elemv.setAttribute("type","application/x-shockwave-flash");
  </code></pre>
  
  <p>Then, I use websockets to bring the paths of the videos from the database. I create an array with them. When the user clicks "next" for example, I load the next array item in a div</p>
  
  <pre><code>//if html5 video
  
      {document.getElementById("videogal").innerHTML=' ';
             //get the next source and then load it
           elemv.src=mplv[i];
          document.getElementById("videogal").appendChild(elemv);     
          }
  
  //if youtube link
  
       document.getElementById("videogal").innerHTML='&lt;object id="viewer" &gt;'+mplv[i]+'&lt;/object&gt;';
  </code></pre>
  
  <p>That's makes it possible to have youtube and html5 videos in the same gallery. All the youtube links are like <code>&lt;iframe width="640" height="360" src="//www.youtube.com/embed/LIS2uZ8a9YQ" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;</code>. Width is always <code>640</code></p>
  
  <p><em>The problem:</em></p>
  
  <p>At the beggingn of my code I set <code>"width", "70%"</code>. This works only for the html5 videos, Any suggestions on how to make it work for the youtube videos?</p>
  
  <p>I tried 
  <code>document.getElementById("videogal").innerHTML='&lt;object id="viewer" width= "70%;" &gt;'+mplv[i]+'&lt;/object&gt;';</code></p>
  
  <p>(added width), but does not work.</p>
  
  <p>How do I fix this?</p>
  
  <p>Thanks in advance</p>