How do i link audio to a picture so when clicked on audio plays or have audio play once web page opens | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i link audio to a picture so when clicked on audio plays or have audio play once web page opens

audio links

28th Jan 2017, 9:48 AM
Marco
3 Answers
+ 2
<audio src="url_audio_file" id="player"> <script> document.getElementById('player').play() </script> But you can avoid <audio> html element, with only JS: var audio = new Audio('url_audio_file'); audio.play();. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Video_and_audio_content http://www.w3schools.com/html/html5_audio.asp
29th Jan 2017, 6:31 AM
visph
visph - avatar
+ 1
You might want to visit the w3schools reference page regarding the html5 <audio> tag. They provide some good examples along with the definition.
28th Jan 2017, 11:51 AM
Ousmane Diaw
0
@visph thanks .. im new to this 3 days in
29th Jan 2017, 8:09 AM
Marco