#1 21. Januar 2013 Hallo ich habe 2 YT Videos und möchte das sie beim besuch meiner Seite zufällig abwechselnd angezeigt werden. Wie könnte ich das anstellen ? + Multi-Zitat Zitieren
#2 21. Januar 2013 Zuletzt bearbeitet: 21. Januar 2013 AW: youtube videos rotieren lassen PHP PHP: <? PHP $youtubeVideos = array( 'oHg5SJYRHA0' , 't1kApnsayeQ' ); $randomYoutubeVideoId = $youtubeVideos [ array_rand ( $youtubeVideos , 1 ) ]; echo '<iframe width="560" height="315" src="http://www.youtube-nocookie.com/embed/' . $randomYoutubeVideoId . '?rel=0" frameborder="0" allowfullscreen></iframe>' ; --- ODER --- Javascript: HTML: <div id="randomvideo"></div> <script> var youtubeVideos = ['oHg5SJYRHA0','t1kApnsayeQ']; var random = Math.floor(Math.random()*youtubeVideos .length); var randomYoutubeVideoId = youtubeVideos[random]; document.getElementById('randomvideo').innerHTML = '<iframe width="560" height="315" src="http://www.youtube-nocookie.com/embed/'+randomYoutubeVideoId+'?rel=0" frameborder="0" allowfullscreen></iframe>' </script> 1 Person gefällt das. + Multi-Zitat Zitieren