View Full Version : Load movie into a div

10-29-2005, 02:13 PM
Does someone know how i can load a movie into a div when i click a link?

Maybe a little change with javascript from the thumbnail viewer (http://www.dynamicdrive.com/dynamicindex4/thumbnail2.htm)
I want to use it in combination with images

10-29-2005, 03:18 PM
If you mean a quicktime .mov, I've done this before. Here is an example link for use with the script you mentioned:

<a onMouseover="document.getElementById('dynloadarea').innerHTML='<iframe src=\'filename.mov\' width=\'300\' height=\'300\' scrolling=\'auto\' frameborder=\'0\'></iframe>'">
<img src="thumb2.jpg" width="50" height="50"></a>

10-29-2005, 03:33 PM
And if its wmv.. (with your code it opens windows media player)
Can i change the innerhtml ?
<AREA SHAPE="rect" COORDS="0,256,240,277" HREF="#" onclick="document.getElementById('imglayer').innerHTML='
<iframe width=\'220\' height=\'220\' scrolling=\'no\' frameborder=\'0\'>
<embed src=\'mms://stream.2003.02.garnierprojects.com/tmf/music/armin_shivers_512.wmv#0;1.000;0;0;1:2;2:2\' width=\'220\' height=\'220\' type=\'video/x-ms-asf\' autoplay=\'true\' loop=\'false\' volume=\'50\'>
</embed></iframe>'" ALT="">

10-29-2005, 03:55 PM
No, you would make up a separate page with the embed code on it, call that page say, movie.htm . Then you could use:

<a onMouseover="document.getElementById('dynloadarea').innerHTML='<iframe src=\'movie.htm\' width=\'300\' height=\'300\' scrolling=\'auto\' frameborder=\'0\'></iframe>'">
<img src="thumb2.jpg" width="50" height="50"></a>

Note: With .mov, if you use embed you need to use object/embed code for the movie to play in IE and other browsers (object for IE, embed for others). This may also be true for .wmv, I don't know for sure.

Here is an example page with object/embed for .mov (the 'saved from' comment line is required for some local IE implementations only):

<!-- saved from url=(0014)about:internet -->
<object width="160" height="300"
<param name="src" value="filename.mov">
<param name="autoplay" value="true">
<param name="controller" value="false"><embed src="filename.mov" width="160" height="300"
autoplay="true" controller="false"

A web search should be able to find you one for .wmv if needed.