在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
首先将以下代码加入网页中: <span id="Text"></span> function CurrentPosition() { if (document.winplayer.PlayState != 2) return; cPos.style.pixelLeft = ToBarPosition(document.winplayer.CurrentPosition); Text.innerHTML = ToPosition(winplayer.currentposition) + "/" + ToPosition(winplayer.Duration) ; } //保留两个小数 function format2(str) { str=Math.round(parseFloat(str)*100)/100 return str } function ToPosition(pos) { var levelt; levelt = ((cmaxX - cminX) * pos) / document.winplayer.Duration; levelt =(parseInt(levelt) + cminX)/60; levelt =format2(levelt); return levelt; } //以上是时间转换函数,如5.34,这后面的0.34相当于60*0.34=20秒,改进后的函数如下: function ToPosition(pos) { var levelt; levelt = ((cmaxX - cminX) * pos) / document.winplayer.Duration; levelt =(parseInt(levelt) + cminX)/60; levelt=parseInt(levelt) + ":" + parseInt((format2(levelt)-parseInt(levelt))*60); return levelt; } |
请发表评论