SyntaxFix
Write A Post
Hire A Developer
Questions
JavaScript
function playAudio(url) { new Audio(url).play(); }
HTML
<img src="image.png" onclick="playAudio('mysound.mp3')">
Supported in most modern browsers and easy to embed into HTML elements.