Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
SVM
(view source)
Revision as of 18:58, 22 May 2023
89 bytes added
,
18:58, 22 May 2023
no edit summary
Line 2:
Line 2:
<html>
<html>
<head>
<head>
−
<title>YouTube Video
Auto
Play</title>
+
<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
?autoplay=1
';
+
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);
}
}
−
−
window.onload = loadVideo;
</script>
</script>
</body>
</body>
</html>
</html>
Mcintyre
581
edits
Navigation menu
Personal tools
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version