幽灵资源网 Design By www.bzswh.com
本文为大家分享了jQuery实现的音乐播放试听列表,可以实现播放,暂停,自动获取音频路径功能,具体内容如下
1.html文件
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>音乐播放试听列表</title> </head> <body> <script src="/UploadFiles/2021-04-02/jquery.min.js">2.run.js
// // @author FUCMLIF // @date 2016/4/6 // jQuery("a.user_doplay").click(function(){ var x = document.getElementById("myAudio"); if (x.paused) { jQuery("a.user_doplay").find('img').attr('src','http://sandbox.runjs.cn/uploads/rs/424/shsayjwv/play.png'); jQuery(this).find('img').attr('src','http://sandbox.runjs.cn/uploads/rs/424/shsayjwv/stop.png'); jQuery(this).attr("name","playing"); x.play(); //播放 } else if (x.play && jQuery(this).attr("name") == "stoped") { jQuery('#myAudio').attr('src',jQuery(this).attr('id') + '.mp3');//修改音频路径 jQuery("a.user_doplay").find('img').attr('src','http://sandbox.runjs.cn/uploads/rs/424/shsayjwv/play.png'); jQuery(this).find('img').attr('src','http://sandbox.runjs.cn/uploads/rs/424/shsayjwv/stop.png'); jQuery("#play_list_ol").find('a').attr('name','stoped'); jQuery(this).attr("name","playing"); x.play(); //播放 } else if (x.play && jQuery(this).attr("name") == "playing") { jQuery(this).find('img').attr('src','http://sandbox.runjs.cn/uploads/rs/424/shsayjwv/play.png'); jQuery("#play_list_ol").find('a').attr('name','stoped'); x.pause(); //暂停 } else { alert("这个提示不应该出现"); } });以上就是本文的全部内容,希望对大家的学习有所帮助。
幽灵资源网 Design By www.bzswh.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
幽灵资源网 Design By www.bzswh.com
暂无评论...