beanymanuk Posted April 21, 2010 Share Posted April 21, 2010 I want to pass the result that appears in the div videotime to a php variable which I can then use to add the data to my database How can I do this? <p>position:</p><div id="videotime"></div> <script type="text/javascript"> // get video element var video = document.getElementsByTagName("video")[0]; function writeVideoTime(t) { document.getElementById("videotime").innerHTML=t; } </script> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted April 21, 2010 Share Posted April 21, 2010 You need AJAX. Or use frames, but that is highly not recommended as frames are pretty much dead nowadays. Also, what's a video tag? document.getElementsByTagName("video")[0]; Quote Link to comment Share on other sites More sharing options...
beanymanuk Posted April 21, 2010 Author Share Posted April 21, 2010 The video bit is just going to a video tag and getting the current time point of the video How could I go about passing the value using ajax exactly in simplist way possible Quote Link to comment Share on other sites More sharing options...
seventheyejosh Posted April 21, 2010 Share Posted April 21, 2010 Also, what's a video tag? document.getElementsByTagName("video")[0]; http://www.w3schools.com/html5/tag_video.asp Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted April 21, 2010 Share Posted April 21, 2010 Also, what's a video tag? document.getElementsByTagName("video")[0]; http://www.w3schools.com/html5/tag_video.asp I was referring to the code posted. Quote Link to comment Share on other sites More sharing options...
seventheyejosh Posted April 21, 2010 Share Posted April 21, 2010 As was I. <video> is a tag? So why not get it by name? http://developer.apple.com/safari/library/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html Excerpt: <!DOCTYPE html> <html> <head> <title>Simple JavaScript Controller</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script type="text/javascript"> function playPause() { var myVideo = document.getElementsByTagName('video')[0]; if (myVideo.paused) myVideo.play(); else myVideo.pause(); } function makeBig() { var myVideo = document.getElementsByTagName('video')[0]; myVideo.height = (myVideo.videoHeight * 2 ) ; } function makeNormal() { var myVideo = document.getElementsByTagName('video')[0]; myVideo.height = (myVideo.videoHeight) ; } </script> </head> <body> <div class="video-player" align="center"> <video src="myMovie.m4v" poster="poster.jpg" ></video> <br> <a href="javascript:playPause();">Play/Pause</a> <br> <a href="javascript:makeBig();">2x Size</a> | <a href="javascript:makeNormal();">1x Size</a> <br> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.