PDA

Click to See Complete Forum and Search --> : displaying a movie..


merhaba
Oct 29th, 2003, 09:49 AM
: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>

vbNeo
Oct 29th, 2003, 10:35 AM
Try This:


<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>

Acidic
Oct 29th, 2003, 11:00 AM
very small change in code required (at least for me)
change the DIVs "name" property to "id".
so NOT:
name="Moviediv"
but
id="Moviediv"

vbNeo
Oct 29th, 2003, 11:12 AM
I wrote it to fast - sorry, it's ofcourse ID (getElementById), My bad!

CornedBee
Oct 30th, 2003, 02:09 PM
And you'll probably want quotes around the style property value of the button - though most browsers will accept the wrong code too.