
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
Execute a script each time the volume of a video/audio is changed in HTML?
The onvolumechange attribute trigger when the user change the volume of the video or audio accessed on the web page. This change can be volume up, volume down, mute, etc.
Example
You can try to run the following code to implement onvolumechange attribute −
<!DOCTYPE html> <html> <body> <h2 id="test">Play</h2> <video id = "myid" width = "320" height = "176" controls onvolumechange = "myFunction()"> <source src = "/html5/foo.ogg" type = "video/ogg" /> <source src = "/html5/foo.mp4" type = "video/mp4" /> Your browser does not support the video element. </video> <script> function myFunction() { document.getElementById("test").innerHTML = "Volume changed"; } </script> </body> </html>
- Related Articles
- Execute a script each time the playback rate changes in HTML?
- Execute a script when the playback position of the media has changed in HTML?
- Execute a script when the file is unavailable in HTML?
- Execute a script when the element is invalid in HTML?
- Execute a script before the document is printed in HTML?
- Execute a script after the document is printed in HTML?
- Execute a script when the element is finished loading in HTML?
- Execute a script when the browser window is closed in HTML?
- Execute a script when the element is being dragged in HTML?
- Execute a script when the element is being clicked in HTML?
- Execute a script when media data is loaded in HTML?
- Execute a script at the start of a drag operation in HTML?
- Execute a script when a user is pressing a key in HTML?
- HTML 5 video or audio playlist
- Execute a script when the content of the element is being cut in HTML?

Advertisements