代码较最基础的播放器实现增加了playlist,使用MakeList实现多首播放,有需要的可以直接使用:
<!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> <title>Untitled Page</title> </head> <body style="font-family:Verdana; font-size:12px"> <script> /************************************************************* LovelyLife Player V1.0 Edited By LovelyLife At 2006-09-16 All rights reservered Code Start Modify by http://www.tt419.cn/ *************************************************************/ var playid = "LovelyLifePlayer" var status = "status" var curId,arrPL,selected var isStop,isLoop arrPL = new Array() //播放器列表 cur = 0 curId = 0 isStop = false selected = 0 isLoop = true function songObj(Id,url, name){ this.Id = Id this.url = url this.name = name } function playAndpauseIt(){ if(document.getElementById(status).innerText == '暂停'){ document.getElementById(playid).controls.pause() document.getElementById(status).innerHTML ='播放' } else{ document.getElementById(status).innerText = '暂停' document.getElementById(playid).controls.play()} } function stopIt(){ isStop = true document.getElementById(status).innerHTML ='播放' document.getElementById(playid).controls.stop() } function showTimer(){ var cp=document.getElementById(playid).controls.currentPosition var cps=document.getElementById(playid).controls.currentPositionString var dur=document.getElementById(playid).currentMedia.duration; var durs=document.getElementById(playid).currentMedia.durationString; var s = document.getElementById(playid).playState var o = document.getElementById(playid).openState if( s==2 || s==3) document.getElementById('pos').innerText = " " + cps + "/" + durs + " " else document.getElementById('pos').innerText = " 00:00/" + durs + " " if( s == 1 ){ if(isLoop && (curId > (arrPL.length - 1))){ curId = 0 return 0 } clearIt() if(curId<0 || curId>arrPL.length){ alert("当前没有歌曲!,请查看播放列表!") return false } nxtPlay() } if( s == 10 && arrPL.length >0 ) nxtPlay() } function nxtPlay(){ isStop = true if(curId > arrPL.length - 1){ document.getElementById("songName").innerText = "没有歌曲了,请选择上一曲!" document.getElementById(playid).URL = "NULL" return false } curId++ clearIt() setIt(curId) PlayIt(curId) } function prePlay(){ isStop = true if(curId<0){ document.getElementById("songName").innerText = "没有歌曲了,请选择下一曲!" document.getElementById(playid).URL = "NULL" return false } curId-- clearIt() setIt(curId) PlayIt(curId) } function PlayIt(cid){ if(curId<0 || curId>arrPL.length -1){ document.getElementById("songName").innerText = "当前没有歌曲!,请查看播放列表!" return false } url = arrPL[cid].url; curId = cid if(url == "None"){ document.getElementById("songName").innerText = "加载歌曲未找到!播放下一曲!" nxtPlay() return false } document.getElementById(playid).URL = url document.getElementById("songName").innerText = arrPL[cid].name } function clearIt(){ if((arrPL.length - 1 <0) || selected < 0 || selected > arrPL.length){ return false } } function setIt(tid){ if(tid<0 || tid>arrPL.length-1){ document.getElementById("songName").innerText = "当前没有歌曲!,请查看播放列表!" return false } } function InitPlay(songName,url,auto){ var strTemp = "<object classid=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\"" strTemp += " type=\"application/x-oleobject\" width=\"0\" height=\"0\" id=" + playid strTemp += " style=\"position:relative; left:0px; top:0px; width:0px; height:0px;\">\n" strTemp += " <param name=\"autoStart\" value=\""+auto+"\">\n" strTemp += " <param name=\"balance\" value=\"0\">\n" strTemp += " <param name=\"currentPosition\" value=\"0\">\n" strTemp += " <param name=\"currentMarker\" value=\"0\">\n" strTemp += " <param name=\"enableContextMenu\" value=\"0\">\n" strTemp += " <param name=\"enableErrorDialogs\" value=\"0\">\n" strTemp += " <param name=\"enabled\" value=\"-1\">\n" strTemp += " <param name=\"fullScreen\" value=\"0\">\n" strTemp += " <param name=\"invokeURLs\" value=\"0\">\n" strTemp += " <param name=\"mute\" value=\"0\">\n" strTemp += " <param name=\"playCount\" value=\"1\">\n" strTemp += " <param name=\"rate\" value=\"1\">\n" strTemp += " <param name=\"uiMode\" value=\"none\">\n" strTemp += " <param name=\"volume\" value=\"100\">\n" strTemp += " <param name=\"URL\" value=\"" + url + "\">\n" strTemp += "</object>\n<font class=HighLight style=\"background-color: #EEE;padding: 8px;height:30px;width:100%\">" strTemp += "<b>点播的歌曲: <marquee width=30% speed=3><font color=red id=songName>" + songName + "</font></marquee>" strTemp += " [<font id=pos></font>]" strTemp += " [<font onclick=playAndpauseIt() style='cursor:hand;' id=" + status + ">播放</font>]" strTemp += "[<font onclick=stopIt() style='cursor:hand;'>停止</font>]" if((arrPL.length - 2) >= 0){ strTemp += "[<font onclick=prePlay() style='cursor:hand;'>上曲</font>]" strTemp += "[<font onclick=nxtPlay() style='cursor:hand;'>下曲</font>]" } strTemp += " </b>" document.getElementById('player').innerHTML = strTemp temptimer=setInterval('showTimer()',1000); } function playX(cur){ PlayIt(cur) clearIt() setIt(cur) curId = cur selected = cur } function MakeList(Id,Url,Name){ arrPL[cur] = new songObj(Id,Url, Name) cur++ } function loopIt(){ if(isLoop){ document.getElementById('sloop').innerText = "不循环" isLoop = false }else{ document.getElementById('sloop').innerText = "循环播放" isLoop = true } } /* Code End */ window.attachEvent('onload', function(){ InitPlay("女人如烟[词曲:穆真 演唱:魏佳艺]","http://happy369.com/yy/nrry.mp3", 1); playAndpauseIt(); }) </script> <div id=player style="width:70%"></div> <script> MakeList(1,"http://happy369.com/yy/nrry.mp3","111"); MakeList(2,"http://www.gxyx.net/sourcefile/0/0/2/2958.wma","222"); MakeList(3,"http://hz.98777.com/rm0402/q/258.rm","333"); MakeList(4,"http://www.gxyx.net/sourcefile/0/0/2/2958.wma","4444"); </script> </body> </html>
MakeList参数:共3个参数,第一个是ID,第二个参数是音乐的URL地址,第三个参数是歌曲的名称。说明都写在注释里了,欢迎大家阅读和参考。

JavaScript在现实世界中的应用包括服务器端编程、移动应用开发和物联网控制:1.通过Node.js实现服务器端编程,适用于高并发请求处理。2.通过ReactNative进行移动应用开发,支持跨平台部署。3.通过Johnny-Five库用于物联网设备控制,适用于硬件交互。

我使用您的日常技术工具构建了功能性的多租户SaaS应用程序(一个Edtech应用程序),您可以做同样的事情。 首先,什么是多租户SaaS应用程序? 多租户SaaS应用程序可让您从唱歌中为多个客户提供服务

本文展示了与许可证确保的后端的前端集成,并使用Next.js构建功能性Edtech SaaS应用程序。 前端获取用户权限以控制UI的可见性并确保API要求遵守角色库

JavaScript是现代Web开发的核心语言,因其多样性和灵活性而广泛应用。1)前端开发:通过DOM操作和现代框架(如React、Vue.js、Angular)构建动态网页和单页面应用。2)服务器端开发:Node.js利用非阻塞I/O模型处理高并发和实时应用。3)移动和桌面应用开发:通过ReactNative和Electron实现跨平台开发,提高开发效率。

JavaScript的最新趋势包括TypeScript的崛起、现代框架和库的流行以及WebAssembly的应用。未来前景涵盖更强大的类型系统、服务器端JavaScript的发展、人工智能和机器学习的扩展以及物联网和边缘计算的潜力。

JavaScript是现代Web开发的基石,它的主要功能包括事件驱动编程、动态内容生成和异步编程。1)事件驱动编程允许网页根据用户操作动态变化。2)动态内容生成使得页面内容可以根据条件调整。3)异步编程确保用户界面不被阻塞。JavaScript广泛应用于网页交互、单页面应用和服务器端开发,极大地提升了用户体验和跨平台开发的灵活性。

Python更适合数据科学和机器学习,JavaScript更适合前端和全栈开发。 1.Python以简洁语法和丰富库生态着称,适用于数据分析和Web开发。 2.JavaScript是前端开发核心,Node.js支持服务器端编程,适用于全栈开发。

JavaScript不需要安装,因为它已内置于现代浏览器中。你只需文本编辑器和浏览器即可开始使用。1)在浏览器环境中,通过标签嵌入HTML文件中运行。2)在Node.js环境中,下载并安装Node.js后,通过命令行运行JavaScript文件。


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

SecLists
SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

记事本++7.3.1
好用且免费的代码编辑器

VSCode Windows 64位 下载
微软推出的免费、功能强大的一款IDE编辑器