【问题标题】:embedding more than one youtube video within a website在网站中嵌入多个 youtube 视频
【发布时间】:2015-06-08 13:45:20
【问题描述】:
我想在我的代码中嵌入 5 个最新的 youtube 视频,我使用了这段代码,但它只显示一个:
<iframe width="300" height="200" src="http://www.youtube.com/embed?max-results=0&controls=0&showinfo=0&rel=0&listType=user_uploads&list=elementanimation" frameborder="0" allowfullscreen="allowfullscreen"> </iframe>
如何编辑它以显示最新的 5 个?谢谢你
【问题讨论】:
标签:
javascript
iframe
video
youtube
embed
【解决方案1】:
你必须像这样为每个视频制作一个 iframe
<iframe width="420" height="315" src="https://www.youtube.com/embed/xxxxxxxxxxx" frameborder="0" allowfullscreen></iframe>
<iframe width="420" height="315" src="https://www.youtube.com/embed/xxxxxxxxxxx" frameborder="0" allowfullscreen></iframe>
<iframe width="420" height="315" src="https://www.youtube.com/embed/xxxxxxxxxxx" frameborder="0" allowfullscreen></iframe>
<iframe width="420" height="315" src="https://www.youtube.com/embed/xxxxxxxxxxx" frameborder="0" allowfullscreen></iframe>
<iframe width="420" height="315" src="https://www.youtube.com/embed/xxxxxxxxxxx" frameborder="0" allowfullscreen></iframe>
但是这样做你必须提前知道你想播放哪个视频,如果你想要动态的东西,你必须使用 php 或 javascript。