$(document).ready(function(){ z=0; }); window.onload = function(){ var oV=document.getElementById('v1'); var aInput=document.getElementsByClassName('v_btn'); var oDiv1=document.getElementById('div1'); var oDiv2=document.getElementById('div2'); var oPlay=document.getElementById('play_btn'); var oPlay_b=document.getElementById('play_box'); var aNews=document.getElementsByClassName('news'); var oOn=document.getElementById('news_on'); var oNext=document.getElementById('news_next'); var N=0; var timer = null; var oW=$("#div1").width(); aInput[0].onclick=function(){ if(oV.paused){ oV.play(); nowTime(); timer = setInterval(nowTime,1000); } else{ oV.pause(); clearInterval(timer); } }; oPlay.onclick=function(){ oV.play(); oPlay_b.style.display = 'none'; nowTime(); timer = setInterval(nowTime,1000); }; oV.onclick=function(){ oV.pause(); oPlay_b.style.display = 'block'; nowTime(); timer = setInterval(nowTime,1000); }; aInput[2].innerText = changeTime(oV.duration); function nowTime(){ aInput[1].innerText = changeTime(oV.currentTime); var scale = oV.currentTime/oV.duration; oDiv2.style.width = scale*oW+'px'; } function changeTime(iNum){ iNum=parseInt( iNum ); var iH=toZero(Math.floor(iNum/3600)); var iM=toZero(Math.floor(iNum%3600/60)); var iS=toZero(Math.floor(iNum%60)); return iH+':'+iM+':'+iS; } function toZero(num){ if(num<=9){ return '0'+num; } else{ return ''+num; } } // 新闻推送 // newstr = setInterval(news,2000); aNews[0].style.display='block'; // function news(){ // if(N==0){ // aNews[N].style.display='block'; // aNews[4].style.display='none'; // N++; // } // else if(0