Dim MusicX() ''音乐文件数组 Dim lMusicX_Index ''数组的播放索引 Dim MusicChache() ''音乐文件缓存 Redim MusicChache(3) Dim lAutoStart ''页面打开时自动播放 Dim hdl_Timer ''计时器句柄 Dim lTimeType ''时间显示方式 Dim lRepeat ''是否单曲重复 Dim lMute ''是否静音 Dim lRandom ''是否随机播放 Dim lAutoHide ''是否自动隐藏 Dim lmXStyle ''是否鼠标在播放器上 Dim lmXShowTime ''播放器无条件显示时间 Dim lmXMaxFrameRow ''初始化父页面的播放器框架的最大高度 Dim lmXMinFrameRow ''初始化父页面的播放器框架的最小高度 Dim lEndStream ''是否执行了一下EndofStream事件 Dim mXHrefURL ''上面框架的地址 '================================================================ Sub Timer1_Timer() if lEndStream=1 then call mXEndStream() Call MusicBoxStyle() if lmXShowTime>0 then lmXShowTime=lmXShowTime-1 Select Case MusicBox.PlayState Case 0 'stop disp1.innerText="AutoHide(ASP版) - [谱乐视听] aboutplayer.com" disp2.innerText="00:00|00:00" playt.src="mx_skin/btn_play.gif" pauzt.src="mx_skin/btn_pauz_off.gif" stopt.src="mx_skin/btn_stop_on.gif" Case 6 'Filename="" disp1.innerText="AutoHide(ASP版) - [谱乐视听] aboutplayer.com" disp2.innerText="00:00|00:00" playt.src="mx_skin/btn_play.gif" pauzt.src="mx_skin/btn_pauz_off.gif" stopt.src="mx_skin/btn_stop_on.gif" Case 2 'playing If lTimeType = 0 Then disp2.innerText = FormatTime(MusicBox.CurrentPosition) & "|" & FormatTime(MusicBox.SelectionEnd) Else disp2.innerText = "-" & FormatTime(MusicBox.SelectionEnd-MusicBox.CurrentPosition) & "|" & FormatTime(MusicBox.SelectionEnd) End If disp1.innerText=MusicX(lMusicX_Index,1) playt.src="mx_skin/btn_play_on.gif" pauzt.src="mx_skin/btn_pauz_off.gif" stopt.src="mx_skin/btn_stop.gif" Case 1 'Pausing playt.src="mx_skin/btn_play.gif" pauzt.src="mx_skin/btn_pauz_on.gif" stopt.src="mx_skin/btn_stop.gif" End Select ''clearTimeout hdl_Timer ''关闭计时器 End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Sub initMusicX() lAutoStart=1 '自动播放 lTimeType=0 '顺序显示时间 lRepeat=0 '不单曲循环 lMute=0 '打开声音 lRandom=1 '初始为顺序播放 lAutoHide=1 '设置为自动隐藏 lmXShowTime=2 '开始时显示2秒 lmXMaxFrameRow=35 '初始化是35行 lmXMinFrameRow=10 '隐藏时显示10行 lEndStream=0 '清除EndofStream事件标识 If lRepeat=1 then '检测是否单曲循环 rept.src="mx_skin/btn_rept_on.gif" else rept.src="mx_skin/btn_rept_off.gif" End if if lRandom=1 then '检测是否循环播放 pmode.src="mx_skin/btn_rndmode_on.gif" else pmode.src="mx_skin/btn_rndmode_off.gif" end if if lMute=1 then '检测是否静音 vmute.src="mx_skin/btn_mute_on.gif" else vmute.src="mx_skin/btn_mute_off.gif" end if MusicBox.Mute=lMute if lAutoHide=1 then '检测是否自动隐藏 ahide.src="mx_skin/btn_ahidemode_on.gif" lmXStyle=0 '开始鼠标没有放在播放器上又设置了隐藏 else ahide.src="mx_skin/btn_ahidemode_off.gif" lmXStyle=1 '设置了显示 end if Call SetMusicList() hdl_Timer=setInterval("Timer1_Timer()",1000) window.parent.main.location="mxfunny.asp?help=0&mxhref=" & mXHrefURL if lAutoStart=1 then Randomize lMusicX_Index = Int((UBound(MusicX) + 1) * Rnd) call mXStart() end if End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Sub mXStart() if lMusicX_Index>=LBound(MusicX) and lMusicX_Index<=UBound(MusicX) then MusicBox.FileName=MusicX(lMusicX_Index,0) End Sub Sub mXPause() if MusicBox.PlayState=2 then MusicBox.Pause exit sub end if if MusicBox.PlayState=1 then MusicBox.Play exit sub end if End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Sub mXStop() MusicBox.Stop End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Sub mXPrev() if lMusicX_Index>LBound(MusicX) then lMusicX_Index=lMusicX_Index-1 call mXStart() end if End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Sub mXNext() if lMusicX_Index0 then window.parent.mXFrame.rows="*," & Cstr(lmXMaxFrameRow) else if lmXShowTime>0 then window.parent.mXFrame.rows="*," & Cstr(lmXMaxFrameRow) else window.parent.mXFrame.rows="*," & Cstr(lmXMinFrameRow) end if end if End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Sub MouseOnMusicBox(lOn) if lAutoHide=1 then lmXStyle=lOn else lmXStyle=1 end if Call MusicBoxStyle() End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Sub mXClose() window.parent.location=mXHrefURL End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Sub mXAbout() window.parent.main.location="mxfunny.asp?help=1&mxhref=" & mXHrefURL End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Sub mXListAbout() window.opener.parent.main.location="mxfunny.asp?help=1&mxhref=" & mXHrefURL window.close End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Sub mXStopEvent() window.event.returnvalue=false End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- '======================辅助函数/过程===================================================== Sub AddMusicList(sURL,sInfo,lTypeID,lID) Dim lChacheCount lChacheCount=UBound(MusicChache) if MusicChache(0)="" or MusicChache(1)="" or len(MusicChache(2))=0 or len(MusicChache(3))=0 then lChacheCount=-1 else ReDim Preserve MusicChache(lChacheCount+4) end if MusicChache(lChacheCount+1)=sURL MusicChache(lChacheCount+2)=sInfo MusicChache(lChacheCount+3)=lTypeID MusicChache(lChacheCount+4)=lID End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Sub SetMusicList() dim lChaCheIndex ReDim MusicX((UBound(MusicChache)-3)/4,3) for lChaCheIndex=0 to UBound(MusicChache) Step 4 MusicX(lChaCheIndex/4,0)=MusicChache(lChaCheIndex) MusicX(lChaCheIndex/4,1)=MusicChache(lChaCheIndex+1) MusicX(lChaCheIndex/4,2)=MusicChache(lChaCheIndex+2) MusicX(lChaCheIndex/4,3)=MusicChache(lChaCheIndex+3) next End Sub '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Function FormatTime(byval lTime) Dim sMin Dim sSec sMin = CStr(lTime \ 60) sSec = CStr(lTime Mod 60) If Len(sMin) = 1 Then sMin = "0" & sMin If Len(sSec) = 1 Then sSec = "0" & sSec FormatTime=sMin & ":" & sSec End Function '---------------------------------------------------------------------------------------- '---------------------------------------------------------------------------------------- Sub expandingWindow(sURL,lWidth,lHeight,sTitle,lScroll,lSpeed) dim sWinLeft dim sWinTop dim sizer dim i dim rc sWinLeft=cstr(window.screen.Width/2-lWidth/2) sWinTop=cstr(window.screen.Height/2-lHeight/2) if lScroll=1 then set sizer=window.open("",sTitle,"left="+sWinLeft+",top="+sWinTop+",menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=0,scrollbars=1,copyhistory=no,width=1,height=1") else set sizer=window.open("",sTitle,"left="+sWinLeft+",top="+sWinTop+",menubar=no,toolbar=no,location=no,directories=no,status=no,resizable=0,scrollbars=0,copyhistory=no,width=1,height=1") end if for i=1 to lWidth step lSpeed rc=sizer.resizeTo(i,"1") next for i=1 to lHeight step lSpeed rc=sizer.resizeTo(lWidth,i) next sizer.location=sURL End Sub '======================================================================================= '---------------------------------------------------------------------------------------- ' mXHrefURL 是您将要添加播放器的网站原来的首页 mXHrefURL="http://www.laobanzhang.com/bbs/index.asp" Call AddMusicList("http://www.365wmw.com/music/我的老班长.wma","我的老班长 - 小曾",5,15) Call AddMusicList("http://upload2.5460.net/data/data2/radio/01/36/76/591774.mp3","军中绿花 - 小曾",5,16) Call AddMusicList("http://220.164.140.195:881/666e_1/2005122116013562/2005122116022375.Wma","海那边的你 - 小曾",5,17) Call AddMusicList("http://220.164.140.195:881/666e_1/2005122116013562/2005122116020531.Wma","相逢是首歌 - 小曾",5,18) Call AddMusicList("http://wma.yytd.com/Wmam/X/200533/235552/861888.Wma","唐古拉兵谣 - 小曾",5,19) Call AddMusicList("http://wma.yytd.com/Wmam/X/200533/235552/861857.Wma","黄菊花开了吗 - 小曾 周亮",6,20) Call AddMusicList("http://wma.yytd.com/Wmam/X/200533/235552/861592.Wma","杯中酒 - 小曾",6,21) Call AddMusicList("http://wma.1ting.com/wmam/znew3_1ting/200502/03a_Xiaozeng/g5.Wma","我的迷彩迷惑不了你 - 小曾",5,22) Call AddMusicList("http://www.cc.ccoo.cn/manage/site/UploadFiles/2005101714753151.wma","军歌联唱(我是一个兵/打靶归来/战友之歌/当兵的人) - 小曾",5,23)