Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript make alert sound

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" 
        content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
  
<body>
    <h1>Press the Button</h1>
  
    <button onclick="play()">Press Here!</button>
  
    <script>
        function play() {
            var audio = new Audio(
'https://media.geeksforgeeks.org/wp-content/uploads/20190531135120/beep.mp3');
            audio.play();
        }
    </script>
</body>
</html>
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #javascript #alert #sound
ADD COMMENT
Topic
Name
3+3 =