Home > Web Front-end > Front-end Q&A > How to stop music in html5

How to stop music in html5

藏色散人
Release: 2021-06-08 10:40:15
Original
3046 people have browsed it

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template