音乐播放用的的几个函数

2018-10-15 17:04

阅读:1530

复制代码 代码如下:
//JavaScriptDocument
varcookiestr;
varTotalSongs;

//插入歌曲列表入口函数
functionInsertsong(songstr){
vartstr;
tstr=songstr.split();
if(tstr.length==5){
if(cookiestr==null)
cookiestr=songstr;
else
cookiestr=cookiestr+###+songstr;
InitList();
}
}

//容错代码
functionkillerror(){returntrue;}
window.onerror=killerror;

//初始化歌曲列表过程
functionInitList(){
varsongarray,htmlstr,i,j,tstr,ttstr,selectedindex;
htmlstr=<selectsize=\5\name=\SongList\style=\width:300px;height:365px;border:1pxsolid#333333;\OnDblClick=\play();\>;
songarray=cookiestr.split(###);
TotalSongs=0;
for(i=0;i<songarray.length;i++){
tstr=songarray[i].split();
if(tstr.length==5){
TotalSongs+=1;
htmlstr+=<optionvalue=\+songarray[i]+\>;
ttstr=TotalSongs+.+tstr[1]+**+tstr[3];
if(ttstr.length<20){
ttstr=ttstr.replace(**,-);
}else{
ttstr=ttstr.replace(**,-);
ttstr=ttstr.substr(0,20)+...;
}
htmlstr+=ttstr+</option>;;
}
}
htmlstr+=</select>;
}

//播放歌曲
functionplay(){
if(SongList.selectedIndex<0)alert(请选择你要播放的曲目!);
else{
varvarvar,person,collect,song,url;
varvar=SongList.options[SongList.selectedIndex].value.split();
url=varvar[0];song=varvar[1];collect=varvar[2];person=varvar[3];SongID=varvar[4];
//if(person.length>5)info_person.innerHTML=person.substr(0,5)+...;
//elseinfo_person.innerHTML=person;
if(collect.length>5)info_collect.innerHTML=collect.substr(0,5)+...;
elseinfo_collect.innerHTML=collect;
if(song.length>5)info_song.innerHTML=song.substr(0,5)+...;
elseinfo_song.innerHTML=song;
MusicGeCi.innerHTML=<iframewidth=\300\height=\278\src=\/song_words/+SongID+.htm\>对不起,你的浏览器不支持框架。</iframe>;
//MusicTitle.innerHTML=song+--+collect;
Exobud.FileName=url;
Exobud.play();
showTLab();
PageAddress.value=PageBasicAddress+SongID;
URLTmp=PageAddress.value;return;
}
}

//控制按钮上一首
functionLast_OneOK(){
if((SongList.selectedIndex>0)&&(SongList.selectedIndex<TotalSongs)){
SongList.options[SongList.selectedIndex-1].selected=true;
play();
}
}

//控制按钮下一首
functionNext_OneOK(){
if((SongList.selectedIndex>=0)&&(SongList.selectedIndex<TotalSongs-1)){
SongList.options[SongList.selectedIndex+1].selected=true;
play();
}
}

functionshowTLab(){
if(document.Exobud.playState==0)Next_OneOK();
setTimeout(showTLab(),1000);
}

functionHighlightAll(theField)
{
vartempval=document.all.PageAddress
tempval.focus()
tempval.select()
therange=tempval.createTextRange()
therange.execCommand(Copy)
}

functionshp(){
varexpDays=1;
varexp=newDate();
exp.setTime(exp.getTime()+(expDays*24*60*60*1000));
if(document.cookie.indexOf(hp)==-1){
document.cookie=hp=yes+;expires=+exp.toGMTString()+;path=/;;
my.style.behavior=url(#default#homepage);
if(!(my.isHomePage(
my.setHomePage(
}
}

Insertsong(url+/vv66_1/10403/1.Wma记得我的名字陈纪匡记得我的名字112739);
Insertsong(url+/vv66_1/10396/4.Wma一生只为你杨臣刚老公PK老婆112679);
SongList.options[0].selected=true;
play();
varPageBasicAddress=
PageAddress.value=PageBasicAddress+112739,112679;


评论


亲,登录后才可以留言!