var audio = document.getElementById("audio"); audio.loop = false; window.onload = function(){//页面加载完毕后调用 var ass = document.getElementById('audio').duration;//如果当前时常为NaN赋值 if(this.isNaN(ass)){ var ids = '[dance:id]'-2; //this.self.location='127.0.0.1/ceshi/index.php/dance/play/id/'+ids; }else{ var ids = '[dance:id]'-1; }; audio.addEventListener('ended', function () {