Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
This is the mark-up part of an aspx page:
HTML
 <input type="text"  id="t1"   önblur="setTime()"/>
  <select name="hai" id="hai1" >
  <option value="0.5">0.5kbps</option>
  <option value="1.0">1.0kbps</option>
  <option value="1.5">1.5kbps</option>
  <option value="2.0">2.0kbps</option>
   </select>
   <button  onclick="bitrates()" >play</button>
  <br> 
  <video id="video1" width="420" controls="controls" src="video/ram.MP4">
  </video>
 

<script type="text/javascript">
    var myVideo = document.getElementById("video1");


    function playPause() {
        if (myVideo.paused)
            myVideo.play();

        else
            myVideo.pause();
    }

    function makeBig() {
        myVideo.width = 600;
    }

    function makeSmall() {
        myVideo.width = 320;
    }

    function makeNormal() {
        myVideo.width = 420;
    }
    function bitrates() {

        myVideo.playbackRate = document.getElementById("hai1").value;
    }

    function setTime() {

        myVideo.currentTime = document.getElementById("t1").value;
    }


   
</script> 

</body>
</html>

The problem that I can't get it work as expected, please help me...
Posted
Updated 12-Nov-13 8:33am
v4

1 solution

Two things...

1. you never call your playPause function, so to play you must use the mouse...

2. click on the button not only runs the bitrate function but also post-back to the server side, and that resets the page...

You may change your code like this...
HTML
<button onclick="bitrates(); return false;">play</button>


That return false; will stop the post-back...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900