jplayer增加选项,参考下图,测试 是一个javascript,如何取得当前播放歌曲的信息?满意答案加分
<scripttype="text/javascript">//<![CDATA[$(document).ready(function(){newjPlayerPlayl...
<script type="text/javascript">
//<![CDATA[
$(document).ready(function () {
new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
}, [
{
title: "123",
free: true,
mp3:"upload/MP3/那年.mp3",
id:"12"
},
{
title: "456",
free: true,
mp3: "upload/MP3/You Make The.mp3",
id:"34"
},
], {
//删除按钮是否显示
playlistOptions: {
enableRemoveControls: true
},
swfPath: "js",
wmode: "window"
});
});
//]]>
function downSong() {
window.open("topic.aspx?id=" + id);
}
</script>
----------------------------------------------------
上面的是javascript代码,downSong()是我加的, jPlayerPlaylist里的id也是加的(不影响功能)。现在就是想让 downSong()取得当前播放歌曲的ID,本人菜鸟,求高手解答。 展开
//<![CDATA[
$(document).ready(function () {
new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
}, [
{
title: "123",
free: true,
mp3:"upload/MP3/那年.mp3",
id:"12"
},
{
title: "456",
free: true,
mp3: "upload/MP3/You Make The.mp3",
id:"34"
},
], {
//删除按钮是否显示
playlistOptions: {
enableRemoveControls: true
},
swfPath: "js",
wmode: "window"
});
});
//]]>
function downSong() {
window.open("topic.aspx?id=" + id);
}
</script>
----------------------------------------------------
上面的是javascript代码,downSong()是我加的, jPlayerPlaylist里的id也是加的(不影响功能)。现在就是想让 downSong()取得当前播放歌曲的ID,本人菜鸟,求高手解答。 展开
展开全部
我也遇到了这个问题。我的解决办法如下:
var myPlaylist;
$(document).ready(function () {
myPlaylist = new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_N",
cssSelectorAncestor: "#jp_container_N"
}, [
{
title: "春暖花开",
artist: "专辑1",
mp3: "mp3/春暖花开.mp3",
id:"35"
},
{
title: "领悟",
artist: "专辑2",
mp3: "mp3/领悟.mp3",
id:"34"
}
], {
playlistOptions: {
enableRemoveControls: true
},
swfPath: "js",
supplied: " mp3",
smoothPlayBar: true,
keyEnabled: true,
audioFullScreen: true
});
});
//输出id,用循环的方法查找当前的歌曲
function ShowId() {
var current = myPlaylist.current,
playlist = myPlaylist.playlist;
jQuery.each(playlist, function (index, obj) {
if (index == current) {
alert(obj.id);
} // if condition end
});
}
也希望能解决你的问题
var myPlaylist;
$(document).ready(function () {
myPlaylist = new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_N",
cssSelectorAncestor: "#jp_container_N"
}, [
{
title: "春暖花开",
artist: "专辑1",
mp3: "mp3/春暖花开.mp3",
id:"35"
},
{
title: "领悟",
artist: "专辑2",
mp3: "mp3/领悟.mp3",
id:"34"
}
], {
playlistOptions: {
enableRemoveControls: true
},
swfPath: "js",
supplied: " mp3",
smoothPlayBar: true,
keyEnabled: true,
audioFullScreen: true
});
});
//输出id,用循环的方法查找当前的歌曲
function ShowId() {
var current = myPlaylist.current,
playlist = myPlaylist.playlist;
jQuery.each(playlist, function (index, obj) {
if (index == current) {
alert(obj.id);
} // if condition end
});
}
也希望能解决你的问题
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询