SoundManager2(音频播放器):检索单击的链接的ID

SoundManager2 (audio player): retrieve the ID of the link that was clicked

本文关键字:单击 链接 ID 检索 音频 播放器 SoundManager2      更新时间:2023-09-26

我使用API创建SoundManager音频播放列表。我遵循了本教程:总

当我点击一个链接(我的播放器中的一首歌)时,在方法play中,我会显示一个包含链接(a)的div,并调用方法投票者()

onplay : // Quand on fait "play"
        function() {
        var t=titre.toString();
        document.getElementById("informations").style.visibility="visible";
        voter();
                                    },

在我想要的voter()方法中,当我点击div的时,我恢复了歌曲。

function voter(){
    $('#informations .container .votes_main .votes_gray .votes_buttons a').click(function () {
        alert(current);
    });
}

问题是:当我点击第一个时,我在警报中很好地恢复了它的id(0)。但是,如果稍后我单击第二个,我会有两个警报,其中包含第二个的id(1)的值,当我再次单击第一个时,我将有3个警报,包含当前歌曲的值(0),依此类推。。。。

我必须如何点击每一个,以及一个包含法庭中歌曲id的警报

提前感谢

我找到了问题的解决方案,并与您分享:

function voter(){
$('#informations .container .votes_main .votes_gray .votes_buttons a').unbind('click').bind('click',function(){
alert(current);
});
}