Home  >  Article  >  Web Front-end  >  How to stop music in html5

How to stop music in html5

藏色散人
藏色散人Original
2021-06-08 10:40:152943browse

html5 Method to stop music: First create an HTML sample file; then use the "onclick="document.getElementById('my').pause()"" method to stop music playback.

How to stop music in html5

The operating environment of this article: windows7 system, HTML5 version, DELL G3 computer

HTML5 music playback stops

The code is as follows:

<!DOCTYPE HTML>
<html>
<body> 
<audio id="my" src="123.mp3">
你的浏览器不支持HTML5
</audio>
<input type="button" onclick="document.getElementById(&#39;my&#39;).play()" value=&#39;播放&#39;/>
<input type="button" onclick="document.getElementById(&#39;my&#39;).pause()" value=&#39;暂停&#39;/>
</body>
</html>

Recommended learning: "HTML Video Tutorial"

The above is the detailed content of How to stop music in html5. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn