日安。我有一个名为audioList的下拉列表控件。每当页面加载时,audioList都是从数据库填充的。在web表单上,我有一个JQuery音频播放器JPlayer。我想要做的是用从audioList获取的值加载JPlayer。
以下是JPlayer在web表单上的代码:
<script type="text/javascript">
$(document).ready(function () {
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
mp3: "" //<--This part links to the mp3's location
});
},
swfPath: "/MediaPlayer/jQuery.jPlayer.2.0.0/",
supplied: "mp3"
});
});
</script>
以下是audioList所在的代码:
protected void Page_Load(object sender, EventArgs e)
{
string query = "SELECT Media_Directory FROM media";
DataTable dt = MySQLHandler.pull(query);
audioList.DataSource = dt;
audioList.DataTextField = dt.Columns[0].ToString();
audioList.DataValueField = dt.Columns[0].ToString(); //<--mp3 file location which is to be placed in JPlayer
audioList.DataBind();
}
发布于 2011-07-06 12:16:58
您可以调用jplayer函数来播放下拉菜单的mp3 onChange事件
发布于 2011-07-06 12:18:45
请参阅Fire event each time a DropDownList item is selected with jQuery
基本上,在选中的下拉列表中添加一个jquery事件,该事件将在jplayer上设置一个属性
https://stackoverflow.com/questions/6596163
复制