Hi, I'm a newbie, so apologies if this is a dumb question or in the wrong place or wrong format.
Below is some code which I'm using to display embedded YouTube videos from a playlist (banners[] ).

Everything works fine except that I cannot get the embedded YouTubes to allow full screen, despite the "allowfullscreen" in the document.write.

Can anyone tell me where I'm going wrong? The script is lifted from elsewhere, and I've only made minor modifications, so I'm a little out of my depth. It sits in the body of an HTML document, inside a div (but it makes no difference if I take it out of the div).

(Incidentally, if I just copy and paste a full YouTube embed code, it works fine and allows full screen).

Out of interest, why on earth are you using old-style YouTube embed code? Much better to go back to YouTube and get the new iFrame method - more reliable and will probably solve your issue. It would also be "cleaner" code too and would allow YouTube to work its magic at getting videos to work on mobiles (iOS & Android) and all other platforms using HTML5. What you have will be very limited in compatibility compared to if you used the new method.

Edit: By the way, it's probably because the browser isn't loading your written HTML properly since it's written after the proper page load cycle which is almost certainly crucial for this to work properly. If you use the iFrame method though, that won't be an issue because all browsers do support writing in an iFrame and immediately loading it - trust me, I've used it.

As to why the old-style code: only because the script I lifted from elsewhere used the old-style embed, and I don't yet know enough to be able to adapt it to the new-style code. I'm sort of stuck between using something as a 'black box' and understanding it enough to tinker. A little knowledge...

As to the position of the script - I tried moving it to the end of the "head" (instead of having it in the body), but it still doesn't give me a fullscreen option; is that what you meant?

I also appreciate that a full answer to my question might need me to have learned a lot more of the fundamentals before I can make sense of it. I guess it's a bit like an air traffic controller getting a call from someone at 40,000ft asking which button makes the plane land!

OK - I have bypassed the problem (mostly) by embedding a YouTube Playlist instead of trying to embed a "playlist" built in the web page itself. This seems like a cleaner solution.
But it raises another question. Can I pass parameters to the embedded youtube playlist so that:
(a) it starts playing as soon as the page loads
(b) it starts at a randomly chosen video in the playlist
and/or
(c) the "Playlist" button in the youtube window is turned "on" so that my playlist appears at the bottom of the video window?

So many questions...(perhaps I should close this question and post a new one on embedded playlists?)