我正在创建多个警报框,所有警报框都需要单独的声音来显示正在显示的警报。
目前,我正在努力让其他音频工作他们的警报框,而不是第一个警报,"呃,谢谢!"是唯一一个使用音频的人。其余警报正在工作,只是没有声音。如何将警报链接到特定声音? 谢谢!
<body onload="delayedAlert();"></body>
<script>
var timeoutID;
function delayedAlert() {
timeoutID = window.setTimeout(slowAlert, 6500);
}
function slowAlert() {
var audio= document.getElementsByTagName('audio')[0];
audio.play();
var myvar1;alert('Ugh, Thank You!');
var myvar2;alert('Sorry, I don’t think I’ve had the pleasure of introducing myself.');
var myvar3;alert('My name is Eve_.What’s your name?');
var myvar4;alert('hello?');
var myvar5;alert('Helllllooooooo?');
var myvar5;alert('Can you hear me?');
}
</script>
<audio>
<source src="Images/thankyou.wav?.wav?.wav?.wav?.wav" type="audio/wav" preload=true>
</audio>
<audio>
<source src="Images/sorry.wav?.wav?.wav" type="audio/wav" preload=true>
</audio>
<audio>
<source src="Images/mynameiseve.wav?.wav?.wav" type="audio/wav" preload=true>
</audio>
<audio>
<source src="Images/Hello?.wav?.wav?.wav?.wav" type="audio/wav" preload=true>
</audio>
<audio>
<source src="Images/canyouhearme.wav?.wav" type="audio/wav" preload=true>
</audio>
<audio>
<source src="Images/hellllloooo.wav" type="audio/wav" preload=true>
</audio>
<audio>
<source src="Images/wellicanthearyou.wav" type="audio/wav" preload=true>
</audio>