Advertisement
Sorceress

Untitled

Aug 4th, 2017
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.32 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.   <body>
  4.  
  5.     Watch Youtube:<br />
  6.     <input type = "text" id = "videoURL" size = "48" maxlength = "48" value = "" autofocus />
  7.     <button onclick = "showNewVideo()">Show Me</button>
  8.     <p id = "feedback"> </p>
  9.  
  10.     <object width = "640" height = "385">
  11.       <param name = "movie" value = "http://www.youtube.com/v/EjUbBsJ0Aow" />
  12.       <param name = "allowFullScreen" value = "true" />
  13.       <param name = "allowscriptaccess" value = "always" />
  14.       <embed name = "videoEmbed" src = "http://www.youtube.com/v/EjUbBsJ0Aow"
  15.       type = "application/x-shockwave-flash"
  16.       allowscriptaccess = "always" allowfullscreen = "true"
  17.       width = "640" height = "385" />
  18.     </object>
  19.      
  20.     <script>
  21.  
  22.       function showNewVideo() {
  23.         var videoURL = document.getElementById("videoURL");
  24.         var videoId = videoURL.value.split("v=")[1];
  25.         if(videoId) {
  26.           document.getElementById("feedback").innerHTML=" ";
  27.           var newURL = "https://www.youtube.com/v/" + videoId;
  28.           document.getElementsByName("movie")[0].value = newURL;
  29.           document.getElementsByName("videoEmbed")[0].src = newURL;
  30.         } else {
  31.           document.getElementById("feedback").innerHTML="no video id?";      
  32.         }
  33.       }
  34.     </script>
  35.      
  36.   </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement