Variable Youtube |
Written on 05/09/20 at 03:54:43 EST by GabbyGirl |
Im trying to load a variable for five you tube videos to randomly grab one as a variable and display it on pageload code: <script> |
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="http://www.youtube.com/embed/' + vtubeselected + '?rel=0" frameborder="0" allowfullscreen></iframe>'); </script>[code] |
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) code: $(document).ready(function(){ |
The comments are owned by the poster. We aren't responsible for its content. |