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
3 Antworten
+ 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
+ 1
You might want to visit the w3schools reference page regarding the html5 <audio> tag. They provide some good examples along with the definition.
0
@visph thanks .. im new to this 3 days in