alert with sound javascript
if (x > 10) {
var snd = new Audio('/alarm.mp3');
snd.play();
alert("Thank you!");
}
alert with sound javascript
if (x > 10) {
var snd = new Audio('/alarm.mp3');
snd.play();
alert("Thank you!");
}
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>
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>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us