知道“音频”何时出现标签 html 已播放
我正在使用音频标签,我想要的是计算已经播放了多少次。
我的代码是这样的:
<audio id="sound" controls="controls" onplaying="doing(this.id)">;
<source src="path/filename" type="audio/wav/">;
</audio>;
<input type="text" id="numbers" value= "0" >
然后在一个 javascript 文件中
Var n=0;
function doing(onplaying)
{
n = n+1;
document.getElementById("numbers").value = n;
}
但它不起作用,有人知道如何做到这一点,像这样或以不同的方式。 提前致谢。
I'm using audio tags, what I want it's to count how many times has been played.
My code it's like this:
<audio id="sound" controls="controls" onplaying="doing(this.id)">;
<source src="path/filename" type="audio/wav/">;
</audio>;
<input type="text" id="numbers" value= "0" >
Then in a javascript file
Var n=0;
function doing(onplaying)
{
n = n+1;
document.getElementById("numbers").value = n;
}
But it does not work, does someone know how to do this, like this or in a different way.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要
play
事件,而不是playing
:http:// jsfiddle.net/a84rC/。You probably want the
play
event, notplaying
: http://jsfiddle.net/a84rC/.