-
displaying a movie..
:wave:
Hi there,
Please help me with the following "script" in which I wanted to display
an AVI movie..on my html page.I want my "movie to be very next to the BUTTON..
but any time I click to watch it. it displays in another white page and my
button disappears..How can I have them both on the same page.?.(my button and my movie)
I dont want to use "frames" I just want to click and there goes my movie..hope you got my poor English..thanks
......................
<html>
<head>
</head>
<body bgcolor=silver>
<script language="javascript">
function start_to_watch()
{
document.write('<embed src="my.avi" width="250" height="250" autostart=true hidden="false" />')
}
</script>
<form>
<input type=button style=background:blue;color:yellow;font-size:24; value="watch it now" onClick="start_to_watch()">
</form>
</body>
</html>
-
hmmm
Try This:
Code:
<html>
<head>
</head>
<body bgcolor=silver>
<script language="javascript">
function start_to_watch()
{
var div;
div=document.getElementById('Moviediv');
div.innerHTML='<embed src="my.avi" width="250" height="250" autostart=true hidden="false" />';
}
</script>
<form>
<div width=250 height=250 name="Moviediv"></div>
<input type=button style=background:blue;color:yellow;font-size:24; value="watch it now" onClick="start_to_watch()">
</form>
</body>
</html>
-
very small change in code required (at least for me)
change the DIVs "name" property to "id".
so NOT:
name="Moviediv"
but
id="Moviediv"
-
Whoops
I wrote it to fast - sorry, it's ofcourse ID (getElementById), My bad!
-
And you'll probably want quotes around the style property value of the button - though most browsers will accept the wrong code too.