Variable Youtube
Written on 05/09/20 at 03:54:43 EST by GabbyGirl
JavascriptingIm trying to load a variable for five you tube videos to randomly grab one as a variable and display it on pageload

   var vtube=new Array()
   var whichvtube=Math.floor(Math.random()*(vtube.length))
   var vtubeselected=(vtube[whichvtube])
<!--I use javascript to assign the videos into an array then select one randomly. I then attempt to pass the variable of the random selected video in the iframe -->

<iframe width="280" height="210" src="" frameborder="0" allowfullscreen></iframe>

Comments on this article:
 You Tube Randomizer
Written on 05/09/20 at 03:58:24 EST by admin
[code]<script type="text/javascript">
var vtube = ['UT000008', 'UT000008', 'UT000008', 'UT000008', 'UT000008'];
var whichvtube = Math.floor(Math.random()*(vtube.length));
var vtubeselected = vtube[whichvtube];

document.write('<iframe width="280" height="210" src="' + vtubeselected + '?rel=0" frameborder="0" allowfullscreen></iframe>');

 using jQuery
Written on 05/09/20 at 04:00:05 EST by GabbyGirl
using jQuery: try this one. (iframe is the id of the iframe tag)

$('#iframe').src=''+<whatever no want to add>

News and Comments Brought to you by: Geeks and Bloggers
The comments are owned by the poster. We aren't responsible for its content.