跪求,音乐连播歌词怎么弄
**************************************前台VS2008****************************************************<%@ Page Language="C#" AutoEventWireup="true" CodeFile="playlist.aspx.cs" Inherits="playlist" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>WebForm1</title>
<script language="javascript" type="text/javascript">
var TotalSongs="<%=Num%>";
function play(){
if(document.Form1.SongList.selectedIndex < 0) alert('请选择你要播放的曲目!');
else{
var song;
url = document.Form1.SongList.options[document.Form1.SongList.selectedIndex].value;
// song="geci.aspx?id="1;
// document.all.IFrame1.src=song;
document.Form1.mPlayer1.URL = url;
document.Form1.mPlayer1.controls.play();
showTLab();
return;
}
}
//播放上一首
function Last_OneOK(){
if((document.Form1.SongList.selectedIndex > 0) && (document.Form1.SongList.selectedIndex < TotalSongs)){
document.Form1.SongList.options[document.Form1.SongList.selectedIndex - 1].selected = true;
play();
}
}
//播放下一首
function Next_OneOK(){
if(document.Form1.SongList.selectedIndex >= 0){
if(document.Form1.SongList.selectedIndex < TotalSongs - 1){
document.Form1.SongList.options[document.Form1.SongList.selectedIndex + 1].selected = true;
play();
}else{
document.Form1.SongList.options[0].selected = true;
play();
}
}
}
function showTLab(){
if(document.Form1.mPlayer1.playState == 1) Next_OneOK();
setTimeout("showTLab()", 5000);
}
</script>
</head>
<body onload="play()">
<form id="Form1" runat="server">
<font face="宋体">
<object id="mPlayer1" height="64" width="700" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" >
<param name="URL" value=""/>
<param name="rate" value="1"/>
<param name="balance" value="0"/>
<param name="currentPosition" value="0"/>
<param name="defaultFrame" value=""/>
<param name="playCount" value="1"/>
<param name="autoStart" value="-1"/>
<param name="currentMarker" value="0"/>
<param name="invokeURLs" value="-1"/>
<param name="baseURL" value=""/>
<param name="volume" value="100"/>
<param name="mute" value="0"/>
<param name="uiMode" value="full"/>
<param name="stretchToFit" value="0"/>
<param name="windowlessVideo" value="0"/>
<param name="enabled" value="-1"/>
<param name="enableContextMenu" value="-1"/>
<param name="fullScreen" value="0"/>
<param name="SAMIStyle" value=""/>
<param name="SAMILang" value=""/>
<param name="SAMIFilename" value=""/>
<param name="captioningID" value=""/>
<param name="enableErrorDialogs" value="0"/>
<param name="_cx" value="18521"/>
<param name="_cy" value="1693"/>
</object>
</font>
<p>
<font face="宋体">
<asp:ListBox id="SongList" style="Z-INDEX: 101; LEFT: 200px; POSITION: absolute; TOP: 160px; height: 372px; width: 219px;"
runat="server"></asp:ListBox></font>
</p>
<asp:ListBox ID="ListBox1" runat="server" Height="344px" Width="169px"></asp:ListBox>
</form>
<script language="javascript" type="text/javascript">
document.Form1.SongList.options[0].selected = true;
play();
</script>
<script language="javascript" type="text/javascript">
if(event.keyCode==13)
{
play();
}</script>
</body>
</html>
****************************************************后台************************************
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class playlist : System.Web.UI.Page
{
private int num;
public int Num
{
get
{
return num;
}
}
protected void Page_Load(object sender, System.EventArgs e)
{
this.SongList.Attributes.Add("onclick", "play();");
string mlist = Request["mid"].ToString();
System.Collections.Hashtable hs = new System.Collections.Hashtable();
if (mlist != "")
{
string[] muid = mlist.Split(',');
num = muid.Length;
string[] muname = mlist.Split(',');
string[] muword = mlist.Split(',');
DB db1 = new DB();
for (int i = 0; i < muid.Length; i++)
{
SqlCommand cmd = new SqlCommand("select * from t_music where f_musicid=" + muid[i].ToString(), db1.conn);
SqlDataReader sdr = cmd.ExecuteReader();
if(sdr.Read())
{
muid[i] = sdr["f_musicname"].ToString();
muname[i] = sdr["f_musicurl"].ToString();
muword[i] = sdr["f_musicword"].ToString();
hs.Add(muid[i], muname[i]);
}
ListBox1.Text = muword[i];
sdr.Close();
}
this.SongList.DataSource = hs;
this.SongList.DataTextField = "key";
this.SongList.DataValueField = "value";
this.SongList.DataBind();
}
}
}
********************************************************************************************
vs2008和sql server 2005 做的,音乐连播做出来了,可是歌词怎么连续显示啊,歌词在数据库里,直接调用就行。
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/dsh01/archive/2009/12/20/5043800.aspx --------------------编程问答-------------------- 如果谁能帮助我,请加我QQ 315141357
我可以在加分。 --------------------编程问答-------------------- 帮你顶一下.
补充:.NET技术 , .NET Framework