Reputation: 719
I am attempting to play 3 songs, one after another by using the onEnded
attribute in HTML5. Here is my first attempt, but I'm getting an error.
Error : Uncaught ReferenceError: src is not defined
nextSong marioKart.html:49
onended marioKart.html:58
Below is my code:
<script>
function nextSong(){
var song = document.getElementById("player");
song.attr(src,"countdown.wav");
}
</script>
</head>
<body>
<div style="position:relative">
<audio controls autoplay="true" onEnded="nextSong()" onplay="race()" >
<source id="player" src="startMusic.wav" type="audio/mpeg" />
</audio>
Can someone help me in achieving this ?
Upvotes: 3
Views: 3680