网站首页 手机版
 注册 登录
您现在的位置: 畅无忧设计 >> 网络编程 >> ASP教程 >> 正文
最新文章
· FSO 组件asp生成html静态页面碰到缓存
· asp实现长文章自动分页插件
· 在ASP中访问和更新Cookies集合
· ASP错误提示大全
· 学习ASP的几个观点
· ASP用两级联动下拉列表来显示大类和小
· ASP取当前页面地址和参数
· ASP删除记录的同时删除相关图片
· asp将查询结果导出到excel
· ASP批量导入Excel到Access或者Sql Se
热门文章
 化境ASP无组件上传类 - upload_5xs
 一个获取ACCESS数据库表名以及表名
 asp将查询结果导出到excel
 艾恩ASP无组件上传修改版
 ASP批量导入Excel到Access或者Sql 
 ASP读取数据库的Flash+JS图片切换特
 ASP用两级联动下拉列表来显示大类和
 ASP+JS实现网页歌曲连播、点播功能
 使用ASP重启服务器
 asp批量替换access数据库中指定字段
相关文章
ASP实现多首歌曲自动连续播放
ASP+JS实现网页歌曲连播、点播功能
来源:百度空间 更新时间:2010/8/31 0:22:23 阅读次数:
字体:[ ] 我要投稿

歌曲播放页面:Player.asp

<title>音乐播放器</title>
<style type="text/css">
body,td,th {
font-size: 12px;
}
.a1{background-color:#99FFCC;}
.a2{background-color:#FFFFFF;}
a:visited {color: #000000;text-decoration: none;font-size: 9pt;}
a:link {text-decoration: none;color: #000000;font-size: 9pt;}
a:hover {text-decoration: underline;font-size: 9pt;color: #FF0000;}
#showList{display:none1;border:1px solid #99CCFF;position:absolute;float:left;top:21px;z-index:20;left:0px;width:214px;filter:alpha(opacity=0);}
#playlist{height:272px;overflow-y: scroll;}
#manage{position:absolute;float:left;top:21px;z-index:20;left:223px;filter:alpha(opacity=0);}
/*a:visited {font-size: 9pt;color: #996600;}*/
</style>
<%
Dim fso,gf,str,filepath,song,i,menu,FileName
FileName="List.js"
menu=Request("menu")
Set fso = CreateObject("Scripting.FileSystemObject")
filepath=server.mappath(FileName)
Set gf = fso.OpenTextFile(filepath)
str = gf.Readall()
gf.Close()
song=Replace(Replace(str,"(",""),")","")
song=split(song,vbcrlf)

if menu="" Then
%>
<body style="margin:0">
<input name="pre" type="button" value="上一首" onClick="pre(0)">
<input name="play" type="button" value="暂停" onClick="act(1)">
<input name="stop" type="button" value="停止" onClick="act(2)">
<input name="next" type="button" value="下一首" onClick="next(1)">
<input name="listbutton" type="button" value="显示列表" onClick="playList()">
<input name="managelistbutton" type="button" value="管理歌曲" onClick="managePlayList()">
<div id="stime" style="z-index:-1;position:absolute">正加加载...</div><script>//second()</script><div id="showList"><div style="background-color:#99CCFF;line-height:23px;padding-left:10px;"><strong>歌曲列表</strong></div><div id="playlist">正加加载...</div></marquee></div><div id="manage"></div>
<iframe name="loading" id="loading" src="?menu=playList" border=0 style="display:none"></iframe>


<OBJECT ID="player" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject"
Standby="Loading.... Microsoft Windows Media Player" width="0" height="0"
style="position:relative;top=1;width:100%;height:100%;display:none;">

<param name="autoStart" value="true">
<param name="balance" value="0">
<param name="baseURL" value="">
<param name="currentPosition" value="0">
<param name="currentMarker" value="0">
<param name="enableContextMenu" value="false">
<param name="enableErrorDialogs" value="false">
<param name="fullScreen" value="false">
<param name="invokeURLs" value="false">
<param name="mute" value="false">
<param name="playCount" value="1">
<param name="rate" value="1">
<param name="stretchToFit" value="true">
<param name="uiMode" value="none">
<param name="volume" value="80">
</OBJECT>

<script language="javascript">
var i,pl,t=null,tidTLab=null;
var n = new Array();
var myPlayer = document.getElementById("player")
<%
Dim m
m=0
for i=0 to Ubound(song)
If Trim(song(i))<>"" Then
%>n[<%=m%>] = <%=Split(song(i),",")(1)%>;
<%
m=m+1
End If
Next
%>

var list=document.getElementById("showList");

function filterin(divin){
if(divin.filters.alpha.opacity>0){
divin.filters.alpha.opacity=divin.filters.alpha.opacity-3;
}else{clearInterval(flt);divin.style.display="none";}
}
function filterout(divout){
divout.style.display="block";
if(divout.filters.alpha.opacity<100){
divout.filters.alpha.opacity=divout.filters.alpha.opacity+2;
}else{clearInterval(flt);}
}

function playList(){
//alert(list.filters.alpha.opacity);
if(listbutton.value=="显示列表"){
listbutton.value="隐藏列表";
flt=setInterval("filterout(list)",1);
}
else if(listbutton.value=="隐藏列表"){
//list.style.display="none";
listbutton.value="显示列表";
flt=setInterval("filterin(list)",1);
}
}
function managePlayList(){
manage.style.display="";
flt=setInterval("filterout(manage)",1);
loading.location.href="?menu=managePlayList";
}
function act(s)
{
switch(s){
case 1:
   if(myPlayer.playState==3){
   play.value="播放";
   myPlayer.controls.pause();
   }else{
   myPlayer.controls.play();
   play.value="暂停";
   }
   break;
case 2:
   clearInterval(tidTLab);
   myPlayer.controls.stop();
   myPlayer.close();
   play.value="播放";
   break;
}
tidTLab=setInterval('msg()',1000);
}
function stop(){myPlayer.controls.stop();msg();}

function changeStyle(sid){
for(var pl=0;pl<n.length;pl++){
if(sid==pl){
document.getElementById("song"+sid).className="a1";
}else{
document.getElementById("song"+pl).className="a2";
}
}
}
function pre()
{
i-=1;
if(i<0){alert("这已是第一首歌");clearInterval(tidTLab);}
else{
myPlayer.controls.stop();
myPlayer.URL=n[i];
myPlayer.controls.play();
changeStyle(i);
tidTLab=setInterval('msg()',1000);
}
}

function playSelect(id){
myPlayer.controls.stop();
clearInterval(tidTLab);
myPlayer.URL=n[id];
myPlayer.controls.play();
i=id;
changeStyle(id);
tidTLab=setInterval('msg()',1000);
}
function next()
{
i+=1;
if(i>=n.length){
myPlayer.controls.stop();
clearInterval(tidTLab);
}
else{
changeStyle(i);
myPlayer.URL=n[i];
myPlayer.controls.play();
tidTLab=setInterval('msg()',1000);
}
}
var v=0,m;


function init(){i=0;myPlayer.URL=n[0];myPlayer.controls.play();tidTLab=setInterval('msg()',1000);}
if(n.length>0){init();}
function msg()
{
if(i<n.length){
stime.innerHTML=" <input type=button disabled value='"+myPlayer.controls.currentPositionString + " | " + myPlayer.currentMedia.durationString + " | 第" + (i+1)+"/"+n.length+"首'>";}
if(myPlayer.PlayState==1 && i<n.length){next();clearInterval(tidTLab);}
}
</script>
</body>
<%
'产生随机数
Session("RandomStr") = ""
Dim RndStr
Randomize
RndStr = ""
For I = 0 to 31
RndStr = RndStr + Chr(Int(26*Rnd)+ 97)
NEXT

ElseIf menu="managePlayList" Then
%>
<textarea name="songList"><%=str%></textarea>
<script language="javascript">
var Manage = parent.document.getElementById("manage");
Manage.style.display = "block";
Manage.innerHTML="";
Manage.innerHTML = Manage.innerHTML + "<div align=center><form id=form name=form method=post action=\"?menu=saveList\" target='loading'><table border=0 cellpadding=4 cellspacing=1 bgcolor=#99CCFF><tr><td><strong> 管理我的音乐---> <font color='#FF0000'>歌曲添加格式:(\"歌曲名\",\"歌曲地址\")</font></strong></td></tr><tr><td bgcolor=#FFFFFF><textarea name=List cols=90 rows=15></textarea></td></tr><tr><td align=center bgcolor=#FFFFFF><input type=submit name=button value='保存修改' onclick=\"flt=setInterval('filterin(manage)',1);this.submit();\"> <input type=button name=Submit value='取消修改' onclick=\"flt=setInterval('filterin(manage)',1);\"></td></tr></table></div>";
parent.document.form.List.value=songList.value;
</script>
<%
ElseIf menu="saveList" Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set text = Fso.CreateTextFile(server.mappath(FileName))
text.WriteLine(Trim(Request("List")))
Text.Close
set fso=nothing
Response.Write"<script language='javascript'>parent.document.getElementById(""manage"").innerHTML='';top.location.reload();</script>"
ElseIf menu="playList" Then
%>
<script language="javascript">
var n = new Array();
var list=parent.document.getElementById("playlist");
list.innerHTML = "";
<%
m=0
For i=Lbound(song) to Ubound(song)
If Trim(song(i))<>"" Then
%>
list.innerHTML = list.innerHTML + "<div id=\"song<%=m%>\" <%if m=0 then response.write "class='a1'"%> style=\"line-height:20px;padding:2px;\"><%=m+1%>、<a href=\"#\" onClick=\"playSelect("+<%=m%>+")\"><%=Split(Replace(song(i),chr(34),""),",")(0)%></a></div>";
<%
m=m+1
End If
Next
%>
</script>
<%
End If
%>

歌曲列表页面:List.js

("爱情转移-陈亦迅","http://www.ytblog.net/blog_musfile/313634577.wma")
("完美-刘德华","http://www.cs37zx.com/zongwu/dianjiao/images/完美.mp3")
("该死的温柔-马天宇","http://www.tvu.sh.xj.cninfo.net/club/forum/files/818.mp3")
("有一种爱叫做放手-阿木","http://61.187.248.209/movie/uploadfiles_3190/200701/20070127163931185.mp3")
("just_one_last_dance","http://www.casterdance.com/movie/music/3just_one_last_dance.mp3")
("不能说的秘密-周杰伦","http://www.ce.cn/kjwh/ylmb/ylpl/200708/17/W020070817347157815752.mp3")
("真的爱你-Beyond","http://www.xujunhui.com/mp3/zdan.mp3")
("大地-Beyond","http://www.dengdong.com/blogmusic/070627.Beyond_Dadi.mp3")

  • 上一篇文章:
  • 下一篇文章:
  • 关于我们 - 联系我们 - 广告服务 - 在线投稿 - 友情链接 - 网站地图 - 版权声明
    CopyRight 2008-2010, CWYDESIGN.COM - 畅无忧设计, Inc. All Rights Reserved
    滇ICP备09005765号