CSS Portal
Run
Search
« Back to
HTML onratechange Event Attribute
<!DOCTYPE HTML> <html> <body> <audio id="myAudio" controls onratechange="myFunction()"> <source src="audio.mp3" type="audio/mpeg"> Your browser does not support the audio tag. </audio> <p id="demo">Change the playback speed of the audio file:</p> <input type="range" min="0.5" max="3" step="0.1" value="1" oninput="changeRate(this)"> <script> function myFunction() { document.getElementById("demo").innerHTML = "Audio speed: " + document.getElementById("myAudio").playbackRate; } function changeRate(obj) { document.getElementById("myAudio").playbackRate = obj.value; } </script> <p>This example shows how to use the onratechange attribute for an AUDIO element.</p> </body> </html>
If this site has been useful, we’d love your support! Running this site takes time and resources, and every small contribution helps us keep creating valuable content. Consider buying us a coffee to keep things going strong!
☕ Buy a Coffee