Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-30-2009, 02:48 PM   PM User | #1
STV1
New to the CF scene

 
Join Date: Apr 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
STV1 is an unknown quantity at this point
hyperlink to video player and start video

On my website I have a video player at the top and below that a list of videos. Users click on one of the videos and that video begins playing in the player at the top of the page. Is there any way that the link the user clicks to play the video can also jump to the video player at the top of the page? I've tried various hyperlinks but I can't get it to work. The videos play fine, but the users don't realize that they need to scroll back up to the top of the page to see the video.

http://manoamano.org/videos/videos.html

#### below is the video player ####

Code:
<div id='videoPlayback' style='width: 425px; height:344px;'>
<!-- <div style='width: 425px; margin-left: auto; margin-right: auto; margin-top: 10px;'> -->
<img src="images/mano-logo-videosNEW425x344.jpg" width="425" height="344">
### The javascript below plays the video ###

Code:
<script type="text/javascript">
function playVideo(sourceId, targetId) {
if (typeof(sourceId)=='string') {sourceId=document.getElementById(sourceId);}
if (typeof(targetId)=='string') {targetId=document.getElementById(targetId);}
targetId.innerHTML=sourceId.innerHTML;
return false;
}
</script>
#### below is the information/variables for a specific video #####
Code:
<div id='PampasdeLeque' style='display: none'>
<object width="425" height="344">
<param name="movie" value="http://www.youtube.com/v/4xCUO3qcPWA&hl "></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/4xCUO3qcPWA&hl&autoplay=1" 
type="application/x-shockwave-flash" wmode="transparent" 
width="425" height="344">
</embed></object>
</div>
#### below is the link that starts a specific video playing in the player above #####

Code:
<A HREF="#" onclick='return playVideo("PampasdeLeque","videoPlayback")'>
<img border="0" src="images/pampasdeleque.jpg" width="120" height="90">
</A>
STV1 is offline   Reply With Quote
Old 04-30-2009, 03:10 PM   PM User | #2
Eldarrion
Regular Coder

 
Join Date: Feb 2009
Location: Wheeling, IL
Posts: 358
Thanks: 5
Thanked 62 Times in 60 Posts
Eldarrion is on a distinguished road
Easily solvable by making the browser follow the link rather than ignore it:

Code:
<script type="text/javascript">
function playVideo(sourceId, targetId) {
if (typeof(sourceId)=='string') {sourceId=document.getElementById(sourceId);}
if (typeof(targetId)=='string') {targetId=document.getElementById(targetId);}
targetId.innerHTML=sourceId.innerHTML;
return true;
}
</script>
Try that, see how it goes for you.
__________________
The way to success is to assume that there are no impossible things. After all, if you think something is impossible, you will not even try to do it.

How to ask smart questions?
Eldarrion is offline   Reply With Quote
Old 04-30-2009, 03:34 PM   PM User | #3
STV1
New to the CF scene

 
Join Date: Apr 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
STV1 is an unknown quantity at this point
that works!

Excellent, elegant, simple solution. Thank You!!!! Wow, I really appreciate your knowledge and your help, you saved me hours of time and hassle and probably saved me from breaking something while trying to fix it. This solution lets me fix it without any chance of breaking anything else on the page.
Thanks again!
STV1 is offline   Reply With Quote
Reply

Bookmarks

Tags
hyperlink, javascript, video, video player, you tube

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:30 AM.


Advertisement
Log in to turn off these ads.