Jump to content

pass javascript output to a php variable


beanymanuk

Recommended Posts

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>

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.