1.直接贴代码 运行即可
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <audio src="https://mp32.9ku.com/upload/128/2020/10/12/1010079.mp3" controls autoplay=true></audio> <audio src="https://mp32.9ku.com/upload/128/2019/07/27/928430.mp3" controls></audio> <audio src="https://mp32.9ku.com/upload/128/2019/11/08/998378.mp3" controls></audio> <script > var audio = document.getElementsByTagName("audio"); for (var i = 0; i < audios.length; i++) { audio[i].addEventListener(‘ended‘, function() { var nextStep = this.nextSibling.nextSibling; if (nextStep.tagName == "AUDIO") { nextStep.play(); } }, false); } </script> </body> </html>
简单记录一下