“JavaScript Make Alert Sound” Respostas de código

Alerta com JavaScript de som

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

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>
Michael Futral

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>
Michael Futral

Respostas semelhantes a “JavaScript Make Alert Sound”

Perguntas semelhantes a “JavaScript Make Alert Sound”

Mais respostas relacionadas para “JavaScript Make Alert Sound” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código