Difference between revisions of "SVM"
Jump to navigation
Jump to search
YouTube Video Click-to-Play
Line 2: | Line 2: | ||
<html> | <html> | ||
<head> | <head> | ||
− | <title>YouTube Video | + | <title>YouTube Video Click-to-Play</title> |
</head> | </head> | ||
<body> | <body> | ||
− | <div id="video-container"></div> | + | <div id="video-container"> |
+ | <button onclick="loadVideo()">Click to Play Video</button> | ||
+ | </div> | ||
<script> | <script> | ||
function loadVideo() { | function loadVideo() { | ||
var container = document.getElementById('video-container'); | var container = document.getElementById('video-container'); | ||
− | var videoUrl = 'https://www.youtube.com/embed/efR1C6CvhmE | + | var videoUrl = 'https://www.youtube.com/embed/efR1C6CvhmE'; |
var iframe = document.createElement('iframe'); | var iframe = document.createElement('iframe'); | ||
Line 17: | Line 19: | ||
iframe.height = 240; | iframe.height = 240; | ||
iframe.setAttribute('allow', 'autoplay'); | iframe.setAttribute('allow', 'autoplay'); | ||
+ | container.innerHTML = ''; // Clear existing content | ||
container.appendChild(iframe); | container.appendChild(iframe); | ||
} | } | ||
− | |||
− | |||
</script> | </script> | ||
</body> | </body> | ||
</html> | </html> |
Revision as of 18:58, 22 May 2023
<!DOCTYPE html>