0
我想从一个if else
声明中播放音频文件,但我有很多问题。获取音频播放与getdocumenttag
当前语句我在代码是这样的:
for(i = 0; i < 16; i++) {
if(getXMLValue(xmlData, 'input'+i) == '1') {
document.getElementById('btn' + i).style.color = '#d00';
document.getElementById('btn' + i).innerHTML = ('• ALERT ' + i);
document.getElementById('error').style.color = '#d00';
document.getElementByTag("audio");
audio.play();
}
else {
document.getElementById('btn' + i).style.color = '#090';
document.getElementById('btn' + i).innerHTML = '•' + getXMLValue(xmlData, 'inputname'+i);
document.getElementById('error').style.color = '#fff';
document.getElementByTag("audio");
audio.stop();
}
}
并从音频标签在网页开始加载:
<audio preload="auto">
<source src="success.wav"></source>
Your browser isn't invited for super fun audio time.
</audio>
我不知道是否有关于整个javascript部分的超时时间的任何事情:
setTimeout("newAJAXCommand('status.xml', updateStatus, true)",500);
作为音频剪辑' success.wav'大约是第二长,刷新500毫秒?
整个页面的代码可以在这里找到:http://pastebin.com/MaQVndJe
你用firefox给? – ApprenticeHacker 2012-01-09 12:03:40
无论是Firefox或铬,我最好是想跨浏览器 – 2012-01-09 12:13:27