-2

I want an image to play a sound when you press it but

This is what I have done so far

<img class="bilde" src="https://bnetcmsus-a.akamaihd.net/cms/gallery/04K7223BD7AU1446613320846.png"/>
ElGavilan
  • 6,610
  • 16
  • 27
  • 36
darthwiper
  • 9
  • 2
  • 7

1 Answers1

0

You should be able to do this if you can use HTML5.

<audio id="sound" src="hello.mp3"></audio>
<img onclick="document.getElementById('sound').play()" class="bilde" src="https://bnetcmsus-a.akamaihd.net/cms/gallery/04K7223BD7AU1446613320846.png">
Jacob See
  • 755
  • 6
  • 17
  • I use this code a lot for someone https://jsfiddle.net/d8m17gw1/ her is a live example http://www.pscompetitiveedge.com/contact.html – mlegg Apr 18 '16 at 19:11