Solved

how to see a movie in another frame using javascript

Posted on 2003-11-27
2
248 Views
Last Modified: 2010-05-18
Hi,
I have two frames on my webpage.
In frame1 I have my links : link1, link2 etc. and I would like to use javascript so that when you click on link1 in frame1 you see a video movie1 in frame2 with eventually the embed tag using windows media player. and link2 will show movie2 etc.
How can I do that?
Thank you
0
Comment
Question by:ilungachris
2 Comments
 
LVL 15

Accepted Solution

by:
Timbo87 earned 250 total points
ID: 9835253
Using this frameset:
<frameset cols="134,*">
<frame name="frame1" noresize src="page1.html">
<frame name="frame2" noresize src="page2.html">
</frameset>

frame1 is the left frame and frame2 is the right frame.

page1.html looks like this:

<script language="JavaScript" type="text/javascript">
function showMovie(moviename, moviewidth, movieheight)
{
var a = "<embed src=\"" + moviename + "\" width=" + moviewidth + " height=" + movieheight+" autostart=true>"
top.frame2.document.open()
top.frame2.document.write(a)
top.frame2.document.close()
}
</script>
<a href="#" onClick = "showMovie('movie1.mpg',640,480)">Movie 1</a>
<br>
<a href="#" onClick = "showMovie('movie2.mpg',320,240)">Movie 2</a>


As long as you copy the entire script tag (from <script> to </script>), you can call the showMovie function like this:
<a href="#" onClick = "showMovie('movie1.mpg',640,480)">Movie 1</a>
file.mpg is the name of the file.
640 is the width of the movie viewer in pixels.
480 is the height of the movie viewer in pixels.
It will output this to the right frame (frame2).

If you have any other questions or if you'd like further customization or explanation, please ask.
0
 

Author Comment

by:ilungachris
ID: 9842168
thank you it works!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now