html tutorial - onpause Attribute in HTML - html5 - html code - html form




Onpause attribute in html

Learn html - html tutorial - Onpause attribute in html - html examples - html programs

  • onpause attribute used trigger an event when the audio/video is paused either by the user or programmatically.
  • The onpause attribute is a part of the Event attribute.

Syntax for onpause attribute in HTML:

<element onpause="script">

Applies To:

Elements Attribute
<audio> onpause
<video> onpause

onpause Attribute Value:

Value Description
script The script to be run on onpause

Sample Coding for onpause Attribute in HTML:

Tryit<!DOCTYPE html>
<html>
    <head>
        <title>Wikitechy onpause attribute</title>
    </head>
    <body>
        <video width="320" height="240" controls onpause="onPause()">
            <source src="hibiscus.mp4" type="video/mp4">
        </video>
       <script>
            function onPause() 
            {
              alert("Please press play button to resume");
            }
       </script>
    </body>
</html>

Code Explanation for onpause Attribute in HTML:

onpause Attribute Code Explanation

  1. The onpause attribute is used to run the JavaScript function where the video is paused by the user.
  2. The <source> element is used to give the location of the video file.
  3. The function onPause() is called by the onpause attribute value. It is used to show an alert message when the video was paused.

Output for onpause Attribute in HTML:

onpause Attribute Output

  1. The output shows that the video player play the video.
  2. onpause Attribute Output
  3. If the video will pause or finished, then the alert message is display on the browser.

Browser Support for onpause Attribute in HTML:

Yes 9.0 Yes Yes Yes

Tips and Notes

  • The onplay attribute is used to define as a script can run the audio or video which will starts either or no longer paused.

Related Searches to onpause Attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×