Preview:
<html>   
<head>   
    <title> Beep sound on button click </title>   
</head>   
  
<body>   
    <center>  
    <h2 style="color:brown"> Example: Beep a sound </h2>  
    <h4> Press the Button to beep a sound </h4>   
  
    <!-- Use embed to provide the link of beep sound from internet -->  
    <embed src="https://www.soundjay.com/button/sounds/beep-01a.mp3" autostart="false" width="0" height="0" id="sound1"  
enablejavascript="true">  
    <button onclick="playSound('sound1')"> Click to beep </button>   
  
    <script>   
           //user-defined function to play a beep sound  
    function playSound(beepSound) {   
  
            //get the sound in JavaScript variable and play it  
        var audio = document.getElementById(beepSound);   
        audio.play() ;  
    }   
    </script>   
    </center>  
</body>   
</html>  
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter