Log in

View Full Version : Question Regarding Embed Youtube



Didymus
01-23-2011, 08:36 PM
Okay, here is the question.

I am using Web Easy 8 Professional (Since I am a dud when it comes to websites), In otherwards, I have just began trying to learn scripting. What I am trying to do is make an embed YouTube for my website, where I can click a button or hyperlink and it will use the same object but change the video.

Right now all I have to do in the Custom Script to get the first video to work is by putting

Code Snippet

<iframe title="YouTube video player" class="youtube-player" type="text/html" width="1280" height="750" src="http://www.youtube.com/embed/9uCsZDace6o?rel=0&amp;hd=1;autoplay=1" frameborder="0" allowFullScreen></iframe>

I can't seem to get it to work with the document viewer script.

Code Snippet from D.Viewer

<form name="jumpy">
<select name="example" size="1" onChange="gone()">

<option value="http://www.yahoo.com" selected>Yahoo.com</option>
<option value="http://www.google.com">Google</option>
<option value="http://www.lycos.com">Lycos</option>
<option value="http://www.AltaVista.com">AltaVista</option>
</select>

<input type="button" name="test" value="Go!" onClick="gone()">
</form>

<script language="javascript">


//Specify display mode (0 or 1)
//0 causes document to be displayed in an inline frame, while 1 in a new browser window
var displaymode=0
//if displaymode=0, configure inline frame attributes (ie: dimensions, intial document shown
var iframecode='<iframe id="external" style="width:95%;height:400px" src="http://www.yahoo.com"></iframe>'

/////NO NEED TO EDIT BELOW HERE////////////

if (displaymode==0)
document.write(iframecode)

function gone(){
var selectedurl=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
if (document.getElementById&&displaymode==0)
document.getElementById("external").src=selectedurl
else if (document.all&&displaymode==0)
document.all.external.src=selectedurl
else{
if (!window.win2||win2.closed)
win2=window.open(selectedurl)
//else if win2 already exists
else{
win2.location=selectedurl
win2.focus()
}
}
}
//-->
</script>

Any help is welcomed

molendijk
01-23-2011, 11:22 PM
See this (http://www.dynamicdrive.com/forums/showthread.php?t=60385).
If you want this to work when the link is a selectbox option, I can figure something out for you.
===
Arie Molendijk.