任何人都可以在这里帮助我,因为我不太清楚问题是什么,我认为这与放置其中一个线。需要帮助,因为按按钮HTML/Javascript时声音不会播放
https://jsfiddle.net/70kwwpqp/
<div class="animatedButton">
<audio id="Sound" src="Sounds/beep.mp3"> </audio>
<a href="Home.html">
<button class="aButton" <onclick="playBeep()"> <img src="img/Home.png"> </button>
</a>
</div>
function playBeep()
{
var sound = document.getElementById("aButton")
sound.play()
}
您分配了 'A按钮' 作为个按钮的类。另外一个错字'
OneNeptune
链接内不允许使用按钮。见https://stackoverflow.com/questions/6393827/can-i-nest-a-button-element-inside-an-a-using-html5 –
'aButton'是一个班级,你正在使用'getElementById' – Nihal