在网站中嵌入多个YouTube视频

时间:2015-06-08 13:45:20

标签: javascript iframe video youtube embed

我想在我的代码中嵌入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?谢谢

1 个答案:

答案 0 :(得分:0)

您必须为每个视频制作一个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。