有人可以帮我理解为什么我的音频不会播放?
HTML:
<div id = "One" class = "square" onmousedown = "playSound(1)" ></div>
<audio id = "sound1" src = "https://s3.amazonaws.com/freecodecamp/simonSound1.mp3"/>
JS:
function playSound(val) {
var soundToPlay = document.getElementByID("sound"+val);
soundToPlay.play();
}
非常感谢:)
答案 0 :(得分:0)
您在Content-Type
处有一个大写D
的拼写错误:
Id
改为:
getElementByID
//-this -----^