How to add audio to a HTML image? -
i'm still new this, i'm trying add audio mp3 sound html image, played when clicked on. how can right?
i've tries few things, '' tag, or installing java-based stuff, soundmanager2, none of them seems work. problem is, don't know how use them properly.
i'm using dreamweaver cs6, in there should option "behaviour"--> play sound, it's not there, i'm lost this.
you can achieve using audio , video dom methods play()
, pause()
onclick of image working demo
<audio id="audio_play"> <source src="http://www.w3schools.com/tags/horse.ogg" type="audio/ogg" /> <source src="http://www.w3schools.com/tags/horse.mp3" type="audio/mpeg" /> </audio> <img src="http://bit.ly/1kx7d49" onclick="document.getelementbyid('audio_play').play(); return false;" /> <img src="http://bit.ly/1mq0tit" onclick="document.getelementbyid('audio_play').pause(); return false;" />
Comments
Post a Comment