Javascript DOM onvolumechange Event via HTML Tag onvolumechange attribute

Introduction

This example demonstrates how to assign an "onvolumechange" event to a video element.

Try to change the volume in the bottom right corner.

View in separate window

<!DOCTYPE html>
<html>
<body>
<video controls onvolumechange="myFunction()">
  <source src="video.mp4" type="video/mp4">
  <source src="video.ogg" type="video/ogg">
  Your browser does not support HTML5 video.
</video>//from   w ww . ja  v  a  2  s .co  m

<p id="demo"></p>
<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "The volume has been changed!";
}
</script>

</body>
</html>



PreviousNext

Related