Solved

how to see a movie in another frame using javascript

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
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.
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 …

791 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