Home > Web Front-end > JS Tutorial > Several functions for music playback_javascript skills

Several functions for music playback_javascript skills

WBOY
Release: 2016-05-16 19:26:31
Original
1283 people have browsed it
Copy code The code is as follows:

//JavaScript Document
var cookiestr;
var TotalSongs;

//Insert song list entry function
function Insertsong(songstr){
var tstr;
tstr = songstr.split("|");
if(tstr.length == 5){
if (cookiestr == null)
cookiestr = songstr;
else
Cookiestr = cookiestr "###" songstr; >window.onerror = killerror;

//Initialization song list process
function InitList(){
var songarray,htmlstr,i,j,tstr,ttstr,selectedindex;
htmlstr = "";
playlist.innerHTML = htmlstr ;
}

//播放歌曲
function play(){
     if(SongList.selectedIndex < 0) alert('请选择你要播放的曲目!');
     else{
        var varvar,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)   "...";
        //else info_person.innerHTML = person;
        if(collect.length > 5) info_collect.innerHTML = collect.substr(0,5)   "...";
        else info_collect.innerHTML = collect;
        if(song.length > 5) info_song.innerHTML = song.substr(0,5)   "...";
        else info_song.innerHTML = song;
        MusicGeCi.innerHTML = "对不起,你的浏览器不支持框架。";
        //MusicTitle.innerHTML = song   "--"   collect;
        Exobud.FileName = url;
        Exobud.play();
        showTLab();
        PageAddress.value = PageBasicAddress   SongID;
        URLTmp = PageAddress.value;return;
     }
}

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

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

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

function HighlightAll(theField) 
{
    var tempval=document.all.PageAddress
    tempval.focus()
    tempval.select()
    therange=tempval.createTextRange()
    therange.execCommand("Copy")
}

function shp(){
 var expDays = 1;
 var exp = new Date();
 exp.setTime(exp.getTime()   (expDays*24*60*60*1000));
 document.cookie = "is_use_cookie=yes"   "; expires="   exp.toGMTString()    "; path=/";
 if(document.cookie.indexOf('hp') == -1) {
  document.cookie = "hp=yes"   "; expires="   exp.toGMTString()    "; path=/;";
  my.style.behavior='url(#default#homepage)';
  if(!(my.isHomePage('http://www.vv66.com/')))
   my.setHomePage('http://www.vv66.com/');
  }
}

Insertsong(url "/vv66_1/10403/1.Wma|记得我的名字|陈纪匡|记得我的名字|112739");
Insertsong(url "/vv66_1/10396/4.Wma|一生只为你|杨臣刚|老公PK老婆|112679");
SongList.options[0].selected = true;
play();
var PageBasicAddress = "http://www.vv66.com/play/lianplayer.asp?id=";
PageAddress.value = PageBasicAddress   "112739, 112679";
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template