JS实现按钮添加背景音乐示例代码
程序员文章站
2022-06-24 17:28:54
1-代码
j...
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-描述
事先给节点绑定事件,点击后出发添加背景音乐
总结
以上所述是小编给大家介绍的js实现按钮添加背景音乐示例代码,希望对大家有所帮助