View Full Version : Make this .mov NOT pre-load?

10-27-2003, 07:03 PM
I have been unable to get an answer to what I hope is a very simple js request.

How do I make the following .mov file NOT pre-load?

What I would like is an embedded .mov file that only displays the poster frame and then gives the user the option to hit the "play" button thus deciding to downolad the .mov

This code is everything I want, except that .mov pre-loads on the page draw.

<embed src="movs/ddrclean.mov" width="350" height="275" hspace="25" vspace="25"autostart=false align="middle" border="0"></embed>

Thanks for any help.


referring URL:

10-28-2003, 09:34 AM
try using createElement or getElementById.innerHTML methods to build that object at demand (on an event)

function goMovie(){
document.getElementById('movie').innerHTML ='<embed src=\"movs/ddrclean.mov\" width=\"350\" height=\"275\" hspace=\"25\" vspace=\"25\"autostart=false align=\"middle\" border=\"0\"></embed>';

<div id="movie"></div>
<input type="button" name="Button" value="Button" onclick="goMovie()">

10-30-2003, 09:38 AM
As far as I can see, you used the code I gave it to you, but you have some errors. Now:

You must have not more than one function with the same name, or you insert as many goMovie functions as movies you have...:-)

I gave you a solution for a single movie. If you have more, you have to parse some parameters to the same, unique, function.
Let's presume that you have 3 movies, in directory movs, and their names are movieone.mov, movietwo.mov and moviethree.mov

Let's see:

function goMovie(param){
var param;
document.getElementById('movie').innerHTML ='<embed src=\"movs/'+param+'.mov\" width=\"350\" height=\"275\" hspace=\"25\" vspace=\"25\"autostart=false align=\"middle\" border=\"0\"></embed>';
<div id="movie"></div>
<input type="button" value="Start Movie One" onclick="goMovie('movieone')"><br>
<input type="button" value="Start Movie Two" onclick="goMovie('movietwo')"><br>
<input type="button" value="Start Movie Three" onclick="goMovie('moviethree')"><br>

You see the point? Each time you press a button, you parse a parameter to the function, a parameter which has the value (string) the same with the name of the movie you want to load. Try this way, and use your file names instead of movieone.mov, movietwo.mov and moviethree.mov

10-30-2003, 11:16 AM
Originally posted by Kor
var param; I think you need to get rid of this line - otherwise the function will use this (empty) local variable, instead of the value passed.

10-30-2003, 11:31 AM
Yes, I presume that specification is useless, but I assure you that is harmless... The code will take the parameter value anyway from event handler because there is a certain value anytime.

I agree anyway, yes, get rid of that:

var param;