Skip to content
Related Articles

Related Articles

Improve Article

HTML onpause Attribute

  • Last Updated : 06 Aug, 2021

The HTML onpause Attribute is a event attribute which when the Audio has been paused by the user or it will be automatically paused or stop.

Usage: This attribute is used in <audio> and <video> Tags.

Attribute Value: This attribute contains single value script which works when onpaused event attribute call. This attribute is supported by <audio> and <video> tags.

Syntax:

<element onpause="myScript">

Example:



html




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML onpause Attribute
    </title>
</head>
 
<body>
     <center>
    <h1>
        GeeksForGeeks
    </h1>
    <h1 style="color:green">
    HTML onpause Attribute
</h1>
 <video controls id="geeks">
            <source src="Geekfun.mp4"
                    type="video/mp4">
        </video>
     
    <script>
        var aud =
            document.getElementById("geeks");
        aud.onpause = function() {
            alert("video is paused now");
        };
    </script>
</body>
 
</html>

Output:

Supported Browsers: 

  • Google Chrome 
  • firefox
  • Safari
  • Opera 
  • Internet Explorer 

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :