I would like to make a button play a B-flat scale when clicked. What am I doing wrong?
<!DOCTYPE html>
<html>
<head>
<script>
function PlaySound() {
alert("hello");
var bflat = new audio();
bflat.src = "bflat.mp3";
document.getElementById(bflat);
bflat.Play();
}
</script>
</head>
<body>
<audio id="bflat"> </audio>
<button onclick="PlaySound"> B Flat </button>
</body>
</html>
onclick="PlaySound"won't work... that is effectively just a reference to the function. To call a function you need to use()so change it toonclick="PlaySound()"