I am searching for a method to display and play different YouTube videos based on a selected CSS style from a drop-down menu. I believe JavaScript can be utilized to detect the chosen CSS.
Include the following in the html header of the page.
<script type="text/javascript" src="=./javascript/playvid4css.js"></script>
For example, CSS options:
red.css
blue.css
Red video plays
Blue video plays
Possibly insert a div
element in the html where the video will be displayed.
<div id="yvideo"></div>
#
YouTube embedding code.
Previous embed code:
<object width="420" height="315">
<param name="movie" value="http://www.youtube.com/v/N9ync7sLSd4?version=3&hl=en_GB&rel=0"></param>
<param name="allowFullScreen" value="true"></param>
<param name="allowscriptaccess" value="always"></param>
<embed src="http://www.youtube.com/v/N9ync7sLSd4?version=3&hl=en_GB&rel=0" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed>
</object>
YouTube iframe code: (possible standard code for all future videos)
<iframe width="420" height="315" src="http://www.youtube.com/embed/N9ync7sLSd4?rel=0" frameborder="0" allowfullscreen></iframe>
#
Any suggestions on how to link JavaScript with CSS to display different YouTube videos, or is there a simpler approach?