Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

alert with sound javascript

  if (x > 10) {
        var snd = new Audio('/alarm.mp3');
        snd.play();
        alert("Thank you!");
    }
Comment

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>
Comment

javascript make alert sound

<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>
  
    <audio id="chatAudio" >
        <source src=
"https://media.geeksforgeeks.org/wp-content/uploads/20190531135120/beep.mp3" 
        type="audio/mpeg">
    </audio>
    <button onclick="play()">Press Here!</button>
   
    <script>
        var audio = document.getElementById('chatAudio');
        function play(){
            audio.play()
        }
    </script>
</body>
</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: cypress verify url 
Javascript :: javascript check if element is visible on screen 
Javascript :: Get LocalStorage from WebView react native 
Javascript :: react link without underline 
Javascript :: typeorm subquery 
Javascript :: react-native-screens 
Javascript :: unary operator javascript 
Javascript :: how to scroll to an element javascript react 
Javascript :: using async in useeffect 
Javascript :: ignore eslint warning one line 
Javascript :: Creating a Node.js MySQL Database 
Javascript :: How to access return value of promise 
Javascript :: Error: Not implemented: window.alert 
Javascript :: javascript radio button value if checked 
Javascript :: regex valid url 
Javascript :: how to convert date format using date pipe in angular 
Javascript :: javascript eval passing variable 
Javascript :: StatusBar 
Javascript :: toast message angular 
Javascript :: nodejs sha512 decrypt 
Javascript :: how to check localstorage not set 
Javascript :: nullish coalescing js 
Javascript :: datetime to date javascript 
Javascript :: javascript regex cheat sheet 
Javascript :: string to object 
Javascript :: mongodb sort objectid 
Javascript :: jquery insert after next element 
Javascript :: angular download image base64 
Javascript :: react native environment variables 
Javascript :: forjs check if key in json 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =