SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Random Video Generator - Problem

    Alright, so I just want an array with embed codes of YouTube videos and each pageload loads a different one from the video. Shouldn't be too complex yeah?

    Here's the code I'm using, but it won't work. Can someone help me out please?

    Code:
    <script type="text/javascript"> 
    
    var video = newArray(); 
    var select=0; 
    
    video[0] = "<iframe width="560" height="200" src="http://www.youtube.com/embed/7Am7i7uM9r0" frameborder="0" allowfullscreen></iframe>"; 
    
    video[1] = "<iframe width="560" height="200" src="http://www.youtube.com/embed/ceBXUyuv4Q0" frameborder="0" allowfullscreen></iframe>"; 
    
    video[2] = "HTML EMBED CODE HERE"; video[3] = "HTML EMBED CODE HERE"; 
    
    select = Math.floor(Math.random() * video.length); document.write(video[select]); 
    
    </script>

  2. #2
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never mind guys, got it figured out.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •