I'm doing a personal project using css/Javascript/html I've encountered a little problem with my audio. The situation is that I have an audio playing as soon as the page loads (that works) but after ones HP turns to 0 I want the audio to change. What happens is once I get to that situation the audio is cut out.
<audio id="myAudio" src="BattleTheme.mp3" type='audio/mp3'></audio>
JavaScript code:
function intervalDone(){
var y=document.getElementById("message");
if(h1<=0){
document.getElementById('att').src="backgrounds/spacertransparent1.png";
document.getElementById('slaz').src="characters/slayerzach/slayerzach-faintTransparent.png";
document.getElementById('myAudio').src="BattleWin.mp3";
y.innerHTML="<center>SlayerZach has fainted, FighterDan13 Wins.</center>";
document.getElementById("butAtt").disabled = true;
document.getElementById("butItems").disabled = true;
document.getElementById("butRun").disabled = true;
}
}