在 html5 中使用暂停和播放按钮

Usage of Pause and Play buttons in html5

本文关键字:播放 按钮 暂停 html5      更新时间:2023-09-26
<table>
    <tr>
        <td><div id="a">&#65;</div></td>
        <td><div class="n">&#78;</div></td>
        <td><div id="t">&#84;</div></td>
    </tr>
</table>

脚本

function animateat() {
  document.getElementById('audioTag1').play();
      document.getElementById('audioTag1').play();
      $("#a").animate(
            { "top": "300px", "color": "white" },
             2000, function () {
                $("#t").animate({  "top": "300px", "color": "white"      
},
                 2000,function () {
                $("#t").animate(
          { "left": "760px" },1000);
}
);
}

.html

<body onload="animatepaapa();">
<audio id="audioTag1" src="paara.wav" preload="auto">
<code>audio</code>

我正在使用HTML5,CSS和JS开发一个场景,如上所示,我想在其中使用播放,暂停以及重播按钮。

如果有办法,请建议我。

/*script*/
$(document).ready(function() {
$("#stop").click(function() {
$("#a").stop(true,false);
$("#t").stop(true,false);
}); 
$("#start").click(function() {
 animateat();
}); 
});
/*html*/
<input type="button" id="start" value="start"/>
                            <input type="button" id="stop" value="stop"/>

它为我工作并满足了我的要求。 谢谢。