How to play a multimedia file using JavaScript?

JavascriptWeb DevelopmentFront End Technology

To play a multimedia file in JavaScript, you can try to run the following code −


      <title>JavaScript Animation</title>
            var imgObj = null;
            function init(){
               imgObj = document.getElementById('myImage');
      = '0px';
            function moveRight(){
      = parseInt( + 10 + 'px';
            window.onload = init;
         <img id = "myImage" src = /images/html.gif" />
         <p>Click button below to move the image to right</p>
         <input type="button" value="Click Me" onclick="moveRight();" />
Published on 23-Feb-2018 15:51:40