Home > Article > Web Front-end > How to stop music in html5
html5 Method to stop music: First create an HTML sample file; then use the "onclick="document.getElementById('my').pause()"" method to stop music playback.
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('my').play()" value='播放'/> <input type="button" onclick="document.getElementById('my').pause()" value='暂停'/> </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!