November 24, 201114 yr how i can ply video by click on navigation form but display the video in same page please look at the attachment
November 25, 201114 yr The trick is to swap the contents of a <div> using javascript and the inner.HTML command. The code below is a little rough but you hopefully should get an idea. If you have lots of videos (and probably hosting them on YouTube) then the Youtube API could be worth looking at. A modified version of the stock code was used to create the radio station on lovelogic.net and all the code is visible (apart from the playlist creator but you won't need that) <head> <script type="text/javascript"> function showvid(vid){ if (vid == 1 )videoFLV='[< 1st flash video embed code >]'; if (vid == 2 )videoFLV='[< 2nd flash video embed code >]'; var curtextval = document.getElementById("video_box"); curtextval.innerHTML = (videoFLV); </script> </head> <body> <div id="video_box"></div> <a onClick="showvid(1)" href="#">first video</a> <a onClick="showvid(2)" href="#">second video</a> </body>
November 25, 201114 yr It could be done but you will not like it. HTML5 requires using at least two video files with different formats to show just one movie see: http://www.w3schools.com/html5/html5_video.asp and for older browsers you still need to add flash support. HTML5 video and CSS CSS can be made to start a video playing on-hover but it stops when the mouse moves away, there is no persistant switch using css. http://www.html5rocks.com/en/tutorials/video/basics/ Using PHP? The video player would ideally need to placed inside the page using an iframe, because making a PHP request reloads the entire page. Without an iframe all the work on screen would be instantly lost. Edited November 25, 201114 yr by Sogo7
Create an account or sign in to comment