Play sound file when image is clicked

前端 未结 3 570
-上瘾入骨i
-上瘾入骨i 2020-12-09 21:51

I am not a native HTML programmer, so please don\'t jump all over me about this simple question.

I have an image that, I am displaying using the followi

3条回答
  •  一生所求
    2020-12-09 22:37

    This answer by @klaustopher helped me. He wrote:

    HTML5 has the new -Tag that can be used to play sound. It even has a pretty simple JavaScript Interface:

      
      
    

    Here's how I implemented his advice so that clicking on the Font Awesome icon "fa-volume-up" (located on the Web page after "mule.") results in "donkey2.mp3" sound playing (note: mp3 doesn't play in all browsers):

    In short, you're treated like a whole person, instead of a rented mule.

提交回复
热议问题