Solved

how to see a movie in another frame using javascript

Posted on 2003-11-27
2
241 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

707 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

13 Experts available now in Live!

Get 1:1 Help Now