Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to play and stop images in javascript. I set here 2 pictures. When I click on play, images will be play and when I click on stop, it must stop. Following is the code:

C#
 <!DOCTYPE html>
 <html>
  <head>
  <title>Image Player</title>
   <script>
var player;

window.onload = function()
{
    player= document.getElementById('player');
}

function playimage()
{
    player.play();
}

function pauseimage()
{
    player.pause();
}

function stopimage()
{
    player.pause();
            player.currentTime=0;

}
  </script>
   </head>
    <body>
<audio controls="controls" id="player">
     imageSorce[0]="IMAG1974-1.jpg";
             imageSorce[1]="gh.jpg";

              imageSorce[2]="IMAG1971.jpg";
</audio>


   <button onclick="playimage()">Play</button><br />
      <button onclick="pauseimage()">Pause</button><br />
       <button onclick="stopimage()">Stop</button><br />
    </body>
       </html>


this code shows me mp3 player beacuse here i set a audio
C#
<audio controls="controls" id="player">
     imageSorce[0]="IMAG1974-1.jpg";
             imageSorce[1]="gh.jpg";

              imageSorce[2]="IMAG1971.jpg";
</audio>

How should I do this with image control in javascript?
Posted

1 solution

You can try various wonderful Jquery plugins for image player/sliders.

Check the links below which might help you to start discovering.

https://code.google.com/p/jsmovie/[^]

https://gist.github.com/kgn/719686[^]

http://css-tricks.com/examples/StartStopSlider/#[^]

Hope this helps
 
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