I am hoping someone out there can shed some light on this one for me. Here is what I am trying to do. I have a web page that has an embedded movie from youtube. I need to give the option to view one of three videos instead. So I added radio buttons and want a change in button to change the displayed video. So far I get no video displayed at all.
The site only supports HTML and JavaScript. Regretfully I cannot use ASP.Net for the job. Below is stripped down code. Can anyone tell me why the video is not displayed at all and is there a flaw in my code below? Thank you.
The site only supports HTML and JavaScript. Regretfully I cannot use ASP.Net for the job. Below is stripped down code. Can anyone tell me why the video is not displayed at all and is there a flaw in my code below? Thank you.
Code:
<HTML>
<BODY BGCOLOR=#000000 text="#FFFFFF" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" link="#990000" vlink="#990000" alink="#990000">
<div align="center">
<script language="javascript">
function SetVideo()
{
var form = document.forms.VideoMenu;
var ChosenVideo = getSelectedValue(form.elements.PodSelect);
var displayCode = "<embed src='[URL unfurl="true"]http://www.youtube.com/v/I8ph8s4psyU&rel=1'[/URL] type='application/x-shockwave-flash' wmode='transparent' width='425' height='355'>";
if (PodSelect = "Pod1") {
displayCode = "<embed src='[URL unfurl="true"]http://www.youtube.com/v/I8ph8s4psyU&rel=1'[/URL] type='application/x-shockwave-flash' wmode='transparent' width='425' height='355'>";
}
else if (PodSelect = "Pod2") {
displayCode = "<embed src='[URL unfurl="true"]http://www.youtube.com/watch?v=fi2g9LQAMp4'[/URL] type='application/x-shockwave-flash' wmode='transparent' width='425' height='355'>";
}
else if (PodSelect = "Pod3") {
displayCode = "<embed src='[URL unfurl="true"]http://www.youtube.com/watch?v=EHvopiire70'[/URL] type='application/x-shockwave-flash' wmode='transparent' width='425' height='355'>";
}
}
function getSelectedValue(flds) {
var i = 0;
var len = flds.length;
while (i < len) {
if (flds[i].checked) {
return flds[i].value;
}
i++;
}
return "";
}
</script>
<p>
<form name="VideoMenu" method="post">
Select a <span lang="en-us">Video to View</span>:<br>
<span lang="en-us">1</span><input name="PodSelect" value="Pod1" type="radio" checked onchange="SetVideo()">
<span lang="en-us"> 2</span><input name="PodSelect" value="Pod2" type="radio" onchange="SetVideo()">
<span lang="en-us"> 3</span><input name="PodSelect" value="Pod3" type="radio" onchange="SetVideo()">
<input name="DoIt" type="submit" value="Show Video" />
</form>
<b><span lang="en-us">Video</span></b><p>
<object width="425" height="355">
<param name="movie" value="[URL unfurl="true"]http://www.youtube.com/v/I8ph8s4psyU&rel=1">[/URL]
<param name="wmode" value="transparent">
<script type="text/javascript">
document.write(displayCode);
</script>
</object>
</div>
</BODY>
</HTML>