【发布时间】:2019-05-05 00:21:32
【问题描述】:
我有以下代码。我的按钮工作正常,但我不知道你是如何使该功能工作的。
我的目标是创建一个按钮,单击该按钮会打开 youtube 视频的 iframe/使其可见。
<body>
<div class="bgimg w3-display-container w3-animate-opacity w3-text-white">
<div class="w3-display-middle">
<h1 class="w3-jumbo w3-animate-top">TAKE YOUR MARK</h1>
<hr class="w3-border-grey" style="margin:auto;width:40%">
<p><button class="w3-center center transparent_btn"
onclick="play1()">go</button></p>
</div>
</div>
</body>
<script>
function play1() {
<iframe width="560" height="315" src="https://www.youtube.com/embed/AkFs3YzxN_E" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
}
【问题讨论】:
标签: html css iframe youtube youtube-iframe-api