当前位置:主页 > 网页前端 > JavaScript代码 >

JS实现按钮添加背景音乐示例代码

时间:2022-08-01 10:47:47 | 栏目:JavaScript代码 | 点击:

1-代码

<html>
<head>
  <meta charset="utf-8">
  <title>js实现按键声</title>
</head>
<body>
  <ul>
    <li>
      <a href="menu-list" rel="external nofollow" rel="external nofollow" rel="external nofollow" >主页</a>
    </li>
    <li>
      <a href="menu-list" rel="external nofollow" rel="external nofollow" rel="external nofollow" >详情</a>
    </li>
    <li>
      <a href="menu-list" rel="external nofollow" rel="external nofollow" rel="external nofollow" >列表</a>
    </li>
  </ul>
  <script language="javascript">
  $(function() {
    $('menu-list').click(function() {
      $('btn-bgm').remove();
      $('body').append('<embed src="button.wav" autostart="true" hidden="true" loop="false" class = "btn-bgm">');
    });
  });
  </script>
</body>
</html>

  2-描述

事先给节点绑定事件,点击后出发添加背景音乐

总结

您可能感兴趣的文章:

相关文章